Merge branch 'master' into fatima

# Conflicts:
#	assets/langs/ar-SA.json
#	assets/langs/en-US.json
#	lib/generated/locale_keys.g.dart
merge-requests/26/head
Fatimah Alshammari 3 years ago
commit f515c0b39a

@ -419,6 +419,8 @@
"adult": "بالغ", "adult": "بالغ",
"updateMember": "هل انت متأكد تريد تحديث بيانات هذا العضو؟", "updateMember": "هل انت متأكد تريد تحديث بيانات هذا العضو؟",
"fieldIsEmpty": "'{data}' الحقل فارغ. الرجاء التحديد", "fieldIsEmpty": "'{data}' الحقل فارغ. الرجاء التحديد",
"pleaseEnterComments": "الرجاء إدخال التعليقات",
"skip": "يتخطى",
"typeCurrentPasswordBelow": "اكتب كلمة المرور الحاليه", "typeCurrentPasswordBelow": "اكتب كلمة المرور الحاليه",
"currentPassword": "كلمة المرور الحاليه", "currentPassword": "كلمة المرور الحاليه",
"profile": { "profile": {
@ -456,5 +458,16 @@
"reset_locale": "Reset Language", "reset_locale": "Reset Language",
"chat": "دردشة", "chat": "دردشة",
"mychats": "دردشاتي", "mychats": "دردشاتي",
"createNewChat": "Create New Chat" "createNewChat": "Create New Chat",
"advancedSearch": "بحث متقدم",
"openNot": "التبليغات المفتوحة",
"fyi": "تبليغات للعلم",
"toDo": "تبليغات الأعمال",
"all": "كل التبليغات",
"meNot": "تبليغات صادرة مني",
"view": "عرض",
"fromUserName": "من",
"sentDate": "تاريخ الإرسال",
"itemTypeDisplayName": "اسم العرض",
"none": "بدون"
} }

@ -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",
"typeCurrentPasswordBelow": "Type Your Current password below", "typeCurrentPasswordBelow": "Type Your Current password below",
"currentPassword": "Current password", "currentPassword": "Current password",
"profile": { "profile": {
@ -456,5 +458,16 @@
"reset_locale": "Reset Language", "reset_locale": "Reset Language",
"chat": "Chat", "chat": "Chat",
"mychats": "My Chats", "mychats": "My Chats",
"createNewChat": "Create New Chat" "createNewChat": "Create New Chat",
"advancedSearch": "Advanced Search",
"openNot": "Open Notifications",
"fyi": "FYI Notifications",
"toDo": "To Do Notifications",
"all": "All Notifications",
"meNot": "Notifications from Me",
"view": "View",
"fromUserName": "From User Name",
"sentDate": "Sent Date",
"itemTypeDisplayName": "Item Type Display Name",
"none": "None"
} }

@ -2,15 +2,20 @@ import 'dart:convert';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/foundation.dart'; import 'package:flutter/foundation.dart';
import 'package:fluttertoast/fluttertoast.dart';
import 'package:http/http.dart'; import 'package:http/http.dart';
import 'package:logger/logger.dart' as L;
import 'package:logging/logging.dart'; import 'package:logging/logging.dart';
import 'package:mohem_flutter_app/api/api_client.dart'; 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'; import 'package:mohem_flutter_app/classes/consts.dart';
import 'package:mohem_flutter_app/classes/utils.dart';
import 'package:mohem_flutter_app/models/chat/get_search_user_chat_model.dart'; import 'package:mohem_flutter_app/models/chat/get_search_user_chat_model.dart';
import 'package:mohem_flutter_app/models/chat/get_single_user_chat_list_Model.dart'; import 'package:mohem_flutter_app/models/chat/get_single_user_chat_list_Model.dart';
import 'package:mohem_flutter_app/models/chat/get_user_login_token_model.dart' as login;
import 'package:shared_preferences/shared_preferences.dart';
import 'package:signalr_netcore/hub_connection.dart'; import 'package:signalr_netcore/hub_connection.dart';
import 'package:signalr_netcore/signalr_client.dart'; import 'package:signalr_netcore/signalr_client.dart';
import 'package:logger/logger.dart' as L;
class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin { class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
List<SingleUserChatModel> userChatHistory = []; List<SingleUserChatModel> userChatHistory = [];
@ -19,21 +24,35 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
L.Logger logger = L.Logger(); L.Logger logger = L.Logger();
TextEditingController message = TextEditingController(); TextEditingController message = TextEditingController();
ScrollController scrollController = ScrollController(); ScrollController scrollController = ScrollController();
static String token =
"eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJuYW1laWQiOiI0MjA2MiIsImVtYWlsIjoiYWFtaXIubXVoYW1tYWRAY2xvdWRzb2x1dGlvbnMuY29tLnNhIiwiaHR0cDovL3NjaGVtYXMubWljcm9zb2Z0LmNvbS93cy8yMDA4LzA2L2lkZW50aXR5L2NsYWltcy91c2VyZGF0YSI6ImFhbWlyLm11aGFtbWFkIiwiaHR0cDovL3NjaGVtYXMueG1sc29hcC5vcmcvd3MvMjAwNS8wNS9pZGVudGl0eS9jbGFpbXMvbW9iaWxlcGhvbmUiOiI5NjY1MzA4OTYwMTgiLCJuYmYiOjE2NjU5MjA2NDEsImV4cCI6MTY2NjAwNzA0MSwiaWF0IjoxNjY1OTIwNjQxfQ.70tXWdpXtQ20PNBO3WF9ScWNWSyECpFfrW7_iuOmNfWmA63PCZzlTO0E6I3q3K9Kg2CWvOT9-dSDLjlRuXuC2w";
bool isLoading = true; bool isLoading = true;
void getChatMemberFromSearch(String sName, int cUserId) async { Future<void> getUserAutoLoginToken() async {
isLoading = true; String userName = AppState().memberInformationList!.eMPLOYEEEMAILADDRESS!.split("@").first.toString();
notifyListeners(); Response response =
Response response = await ApiClient().getJsonForResponse("${ApiConsts.chatSearchMember}$sName/$cUserId", token: token); await ApiClient().postJsonForResponse("${ApiConsts.chatServerBaseApiUrl}user/desktopuserlogin", {"userName": userName, "password": "FxIu26rWIKoF8n6mpbOmAjDLphzFGmpG", "loginType": 2});
login.UserAutoLoginModel userLoginResponse = login.userAutoLoginModelFromJson(response.body);
AppState().setchatUserDetails = userLoginResponse;
await buildHubConnection();
}
Future<List<ChatUser>?> getChatMemberFromSearch(String sName, int cUserId) async {
Response response = await ApiClient().getJsonForResponse(
"${ApiConsts.chatServerBaseApiUrl}${ApiConsts.chatSearchMember}$sName/$cUserId",
token: AppState().chatDetails!.response!.token,
);
return searchUserJsonModel(response.body);
logger.d(response.body);
isLoading = false; isLoading = false;
notifyListeners(); notifyListeners();
} }
List<ChatUser> searchUserJsonModel(String str) => List<ChatUser>.from(json.decode(str).map((x) => ChatUser.fromJson(x)));
void getUserRecentChats() async { void getUserRecentChats() async {
Response response = await ApiClient().getJsonForResponse("${ApiConsts.chatServerBaseApiUrl}${ApiConsts.chatRecentUrl}", token: token); Response response = await ApiClient().getJsonForResponse(
"${ApiConsts.chatServerBaseApiUrl}${ApiConsts.chatRecentUrl}",
token: AppState().chatDetails!.response!.token,
);
ChatUserModel recentChat = userToList(response.body); ChatUserModel recentChat = userToList(response.body);
pChatHistory = recentChat.response; pChatHistory = recentChat.response;
searchedChats = pChatHistory; searchedChats = pChatHistory;
@ -45,24 +64,31 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
isLoading = true; isLoading = true;
Response response = await ApiClient().getJsonForResponse( Response response = await ApiClient().getJsonForResponse(
"${ApiConsts.chatServerBaseApiUrl}${ApiConsts.chatSingleUserHistoryUrl}/$senderUID/$receiverUID/$pagination", "${ApiConsts.chatServerBaseApiUrl}${ApiConsts.chatSingleUserHistoryUrl}/$senderUID/$receiverUID/$pagination",
token: token, token: AppState().chatDetails!.response!.token,
); );
userChatHistory = getSingleUserChatintoModel(response.body); logger.d(response.statusCode);
print(response.body);
if (response.statusCode == 204) {
userChatHistory = [];
} else {
userChatHistory = getSingleUserChatModel(response.body);
}
isLoading = false; isLoading = false;
logger.d(jsonEncode(userChatHistory));
notifyListeners(); notifyListeners();
} }
List<SingleUserChatModel> getSingleUserChatintoModel(String str) => List<SingleUserChatModel>.from(json.decode(str).map((x) => SingleUserChatModel.fromJson(x))); List<SingleUserChatModel> getSingleUserChatModel(String str) => List<SingleUserChatModel>.from(json.decode(str).map((x) => SingleUserChatModel.fromJson(x)));
ChatUserModel userToList(String str) => ChatUserModel.fromJson(json.decode(str)); ChatUserModel userToList(String str) => ChatUserModel.fromJson(json.decode(str));
void buildHubConnection() async { Future<void> buildHubConnection() async {
HttpConnectionOptions httpOp = HttpConnectionOptions(skipNegotiation: false, logMessageContent: true); HttpConnectionOptions httpOp = HttpConnectionOptions(skipNegotiation: false, logMessageContent: true);
hubConnection = await HubConnectionBuilder() hubConnection = await HubConnectionBuilder()
.withUrl(ApiConsts.chatHubConnectionUrl + "?UserId=42062&source=Web&access_token=$token", options: httpOp) .withUrl(ApiConsts.chatHubConnectionUrl + "?UserId=${AppState().chatDetails!.response!.id}&source=Web&access_token=${AppState().chatDetails!.response!.token}", options: httpOp)
.withAutomaticReconnect(retryDelays: [2000, 5000, 10000, 20000]) .withAutomaticReconnect(retryDelays: [2000, 5000, 10000, 20000])
.configureLogging(Logger("Logs Enabled")) .configureLogging(
Logger("Logs Enabled"),
)
.build(); .build();
hubConnection.onclose( hubConnection.onclose(
({Exception? error}) { ({Exception? error}) {
@ -84,21 +110,65 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
await hubConnection.start(); await hubConnection.start();
hubConnection.on("OnUpdateUserStatusAsync", changeStatus); hubConnection.on("OnUpdateUserStatusAsync", changeStatus);
hubConnection.on("OnDeliveredChatUserAsync", onMsgReceived); hubConnection.on("OnDeliveredChatUserAsync", onMsgReceived);
// hubConnection.on("OnUserTypingAsync", onUserTyping); // hubConnection.on("OnUserTypingAsync", onUserTyping);
//hubConnection.on("OnUserTypingAsync", changeTypingStatus); // hubConnection.on("OnUserCountAsync", userCountAsync);
// hubConnection.on("OnUpdateUserChatHistoryWindowsAsync", updateChatHistoryWindow);
// hubConnection.on("OnGetUserChatHistoryNotDeliveredAsync", chatNotDelivered);
} else { } else {
hubConnection.on("OnUpdateUserStatusAsync", changeStatus); hubConnection.on("OnUpdateUserStatusAsync", changeStatus);
hubConnection.on("OnDeliveredChatUserAsync", onMsgReceived); hubConnection.on("OnDeliveredChatUserAsync", onMsgReceived);
// hubConnection.on("OnUserTypingAsync", onUserTyping); // hubConnection.on("OnUserTypingAsync", onUserTyping);
//hubConnection.on("OnUserTypingAsync", changeTypingStatus); // hubConnection.on("OnUserCountAsync", userCountAsync);
// hubConnection.on("OnUpdateUserChatHistoryWindowsAsync", updateChatHistoryWindow);
// hubConnection.on("OnGetUserChatHistoryNotDeliveredAsync", chatNotDelivered);
} }
isLoading = false; isLoading = false;
notifyListeners(); notifyListeners();
} }
void userCountAsync(List<Object?>? args) {
List items = args!.toList();
print("---------------------------------User Count Async -------------------------------------");
logger.d(items);
// for (var user in searchedChats!) {
// if (user.id == items.first["id"]) {
// user.userStatus = items.first["userStatus"];
// }
// }
// notifyListeners();
}
void updateChatHistoryWindow(List<Object?>? args) {
List items = args!.toList();
print("---------------------------------Update Chat History Windows Async -------------------------------------");
logger.d(items);
// for (var user in searchedChats!) {
// if (user.id == items.first["id"]) {
// user.userStatus = items.first["userStatus"];
// }
// }
// notifyListeners();
}
void chatNotDelivered(List<Object?>? args) {
List items = args!.toList();
print("--------------------------------- Chat Not Delivered Windows Async -------------------------------------");
logger.d(items);
// for (var user in searchedChats!) {
// if (user.id == items.first["id"]) {
// user.userStatus = items.first["userStatus"];
// }
// }
// notifyListeners();
}
void changeStatus(List<Object?>? args) { void changeStatus(List<Object?>? args) {
// print("================= Status Online // Offline ====================");
List items = args!.toList(); List items = args!.toList();
for (var user in searchedChats!) { logger.d(items);
for (ChatUser user in searchedChats!) {
if (user.id == items.first["id"]) { if (user.id == items.first["id"]) {
user.userStatus = items.first["userStatus"]; user.userStatus = items.first["userStatus"];
} }
@ -111,7 +181,7 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
if (value.isEmpty || value == "") { if (value.isEmpty || value == "") {
tmp = pChatHistory; tmp = pChatHistory;
} else { } else {
for (var element in pChatHistory!) { for (ChatUser element in pChatHistory!) {
if (element.userName!.toLowerCase().contains(value.toLowerCase())) { if (element.userName!.toLowerCase().contains(value.toLowerCase())) {
tmp.add(element); tmp.add(element);
} }
@ -124,7 +194,7 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
Future<void> onMsgReceived(List<Object?>? parameters) async { Future<void> onMsgReceived(List<Object?>? parameters) async {
List<SingleUserChatModel> data = []; List<SingleUserChatModel> data = [];
for (dynamic msg in parameters!) { for (dynamic msg in parameters!) {
data = getSingleUserChatintoModel(jsonEncode(msg)); data = getSingleUserChatModel(jsonEncode(msg));
logger.d(msg); logger.d(msg);
} }
userChatHistory.add(data.first); userChatHistory.add(data.first);
@ -155,7 +225,7 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
return; return;
} }
String chatData = String chatData =
'{"contant":"$chatMessage","contantNo":"8a129295-36d7-7185-5d34-cc4eec7bcba4","chatEventId":1,"fileTypeId":null,"currentUserId":42062,"chatSource":1,"userChatHistoryLineRequestList":[{"isSeen":false,"isDelivered":false,"targetUserId":$targetUserId,"targetUserStatus":1}],"conversationId":"715f8b13-96ee-cd36-cb07-5a982a219982"}'; '{"contant":"$chatMessage","contantNo":"8a129295-36d7-7185-5d34-cc4eec7bcba4","chatEventId":1,"fileTypeId":null,"currentUserId":${AppState().chatDetails!.response!.id},"chatSource":1,"userChatHistoryLineRequestList":[{"isSeen":false,"isDelivered":false,"targetUserId":$targetUserId,"targetUserStatus":1}],"conversationId":"715f8b13-96ee-cd36-cb07-5a982a219982"}';
await hubConnection.invoke("AddChatUserAsync", args: <Object>[json.decode(chatData)]); await hubConnection.invoke("AddChatUserAsync", args: <Object>[json.decode(chatData)]);
userChatHistory.add( userChatHistory.add(
SingleUserChatModel( SingleUserChatModel(
@ -165,8 +235,8 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
contantNo: "8a129295-36d7-7185-5d34-cc4eec7bcba4", contantNo: "8a129295-36d7-7185-5d34-cc4eec7bcba4",
conversationId: "715f8b13-96ee-cd36-cb07-5a982a219982", conversationId: "715f8b13-96ee-cd36-cb07-5a982a219982",
createdDate: DateTime.now(), createdDate: DateTime.now(),
currentUserId: 42062, currentUserId: AppState().chatDetails!.response!.id,
currentUserName: "aamir.muhammad", currentUserName: AppState().chatDetails!.response!.userName,
targetUserId: targetUserId, targetUserId: targetUserId,
targetUserName: targetUserName, targetUserName: targetUserName,
), ),
@ -182,9 +252,6 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
curve: Curves.easeOut, curve: Curves.easeOut,
duration: const Duration(milliseconds: 300), duration: const Duration(milliseconds: 300),
); );
// scrollController.animateTo(double.parse(userChatHistory.length.toString()), duration: Duration(milliseconds: 500), curve: Curves.fastOutSlowIn);
notifyListeners(); notifyListeners();
} }

@ -57,9 +57,11 @@ class OffersAndDiscountsApiClient {
var bodyData = json.decode(body['result']['data']); var bodyData = json.decode(body['result']['data']);
if(bodyData != null) {
bodyData.forEach((v) { bodyData.forEach((v) {
getSaleCategoriesList.add(OffersListModel.fromJson(v)); getSaleCategoriesList.add(OffersListModel.fromJson(v));
}); });
}
return getSaleCategoriesList; return getSaleCategoriesList;
}, },
url, url,

@ -14,6 +14,7 @@ import 'package:mohem_flutter_app/models/get_mo_notification_body_list_model.dar
import 'package:mohem_flutter_app/models/get_notification_buttons_list_model.dart'; import 'package:mohem_flutter_app/models/get_notification_buttons_list_model.dart';
import 'package:mohem_flutter_app/models/get_po_Item_history_list_model.dart'; import 'package:mohem_flutter_app/models/get_po_Item_history_list_model.dart';
import 'package:mohem_flutter_app/models/get_po_notification_body_list_model.dart'; import 'package:mohem_flutter_app/models/get_po_notification_body_list_model.dart';
import 'package:mohem_flutter_app/models/get_pr_notification_body_list_model.dart';
import 'package:mohem_flutter_app/models/get_quotation_analysis_list_model.dart'; import 'package:mohem_flutter_app/models/get_quotation_analysis_list_model.dart';
import 'package:mohem_flutter_app/models/get_stamp_ms_notification_body_list_model.dart'; import 'package:mohem_flutter_app/models/get_stamp_ms_notification_body_list_model.dart';
import 'package:mohem_flutter_app/models/get_stamp_ns_notification_body_list_model.dart'; import 'package:mohem_flutter_app/models/get_stamp_ns_notification_body_list_model.dart';
@ -28,7 +29,6 @@ import 'package:mohem_flutter_app/models/worklist/hr/get_basic_det_ntf_body_list
import 'package:mohem_flutter_app/models/worklist/hr/get_contact_notification_body_list_model.dart'; import 'package:mohem_flutter_app/models/worklist/hr/get_contact_notification_body_list_model.dart';
import 'package:mohem_flutter_app/models/worklist/hr/get_phones_notification_body_list_model.dart'; import 'package:mohem_flutter_app/models/worklist/hr/get_phones_notification_body_list_model.dart';
import 'package:mohem_flutter_app/models/worklist/replacement_list_model.dart'; import 'package:mohem_flutter_app/models/worklist/replacement_list_model.dart';
import 'package:mohem_flutter_app/models/worklist/update_user_type_list.dart';
import 'package:mohem_flutter_app/models/worklist_response_model.dart'; import 'package:mohem_flutter_app/models/worklist_response_model.dart';
class WorkListApiClient { class WorkListApiClient {
@ -38,13 +38,18 @@ class WorkListApiClient {
factory WorkListApiClient() => _instance; factory WorkListApiClient() => _instance;
Future<List<WorkListResponseModel>?> getWorkList(int pPageNum, String pItemType) async { Future<List<WorkListResponseModel>?> getWorkList(int pPageNum, String pItemType, String pNotificationType,
{String pSearchUser = "", String pSearchItemType = "", String pSentDate = "", String pSearchSubject = ""}) async {
String url = "${ApiConsts.erpRest}GET_WORKLIST"; String url = "${ApiConsts.erpRest}GET_WORKLIST";
Map<String, dynamic> postParams = { Map<String, dynamic> postParams = {
"P_NOTIFICATION_TYPE": "1", "P_NOTIFICATION_TYPE": pNotificationType,
"P_PAGE_NUM": pPageNum, "P_PAGE_NUM": pPageNum,
"P_PAGE_LIMIT": 50, "P_PAGE_LIMIT": 25,
"P_ITEM_TYPE": pItemType, "P_ITEM_TYPE": pItemType,
"P_SEARCH_FROM_USER": pSearchUser,
"P_SEARCH_ITEM_TYPE_DSP_NAME": pSearchItemType,
"P_SEARCH_SENT_DATE": pSentDate,
"P_SEARCH_SUBJECT": pSearchSubject
}; };
postParams.addAll(AppState().postParamsJson); postParams.addAll(AppState().postParamsJson);
return await ApiClient().postJsonForObject((json) { return await ApiClient().postJsonForObject((json) {
@ -231,6 +236,21 @@ class WorkListApiClient {
}, url, postParams); }, url, postParams);
} }
Future<GetPrNotificationBodyList?> getPRNotificationBody(int pNotificationID, int pTransactionID) async {
String url = "${ApiConsts.erpRest}GET_PR_NOTIFICATION_BODY";
Map<String, dynamic> postParams = {
"P_NOTIFICATION_ID": pNotificationID,
"P_TRANSACTION_ID": pTransactionID,
"P_PAGE_LIMIT": 100,
"P_PAGE_NUM": 1,
};
postParams.addAll(AppState().postParamsJson);
return await ApiClient().postJsonForObject((json) {
GenericResponseModel responseData = GenericResponseModel.fromJson(json);
return responseData.getPrNotificationBodyList;
}, url, postParams);
}
Future<List<GetMoItemHistoryList>> getMoItemHistory(int pItemID, int pOrgID) async { Future<List<GetMoItemHistoryList>> getMoItemHistory(int pItemID, int pOrgID) async {
String url = "${ApiConsts.erpRest}GET_MO_ITEM_HISTORY"; String url = "${ApiConsts.erpRest}GET_MO_ITEM_HISTORY";
Map<String, dynamic> postParams = { Map<String, dynamic> postParams = {
@ -481,12 +501,9 @@ class WorkListApiClient {
}, url, postParams); }, url, postParams);
} }
Future<List<GetUserItemTypesList>> getUserItemTypes() async { Future<List<GetUserItemTypesList>> getUserItemTypes() async {
String url = "${ApiConsts.erpRest}GET_USER_ITEM_TYPES"; String url = "${ApiConsts.erpRest}GET_USER_ITEM_TYPES";
Map<String, dynamic> postParams = { Map<String, dynamic> postParams = {};
};
postParams.addAll(AppState().postParamsJson); postParams.addAll(AppState().postParamsJson);
return await ApiClient().postJsonForObject((json) { return await ApiClient().postJsonForObject((json) {
GenericResponseModel responseData = GenericResponseModel.fromJson(json); GenericResponseModel responseData = GenericResponseModel.fromJson(json);
@ -496,15 +513,11 @@ class WorkListApiClient {
Future<UpdateUserItemTypesList?> updateUserItemTypes(List<Map<String, dynamic>> itemList) async { Future<UpdateUserItemTypesList?> updateUserItemTypes(List<Map<String, dynamic>> itemList) async {
String url = "${ApiConsts.erpRest}UPDATE_USER_ITEM_TYPES"; String url = "${ApiConsts.erpRest}UPDATE_USER_ITEM_TYPES";
Map<String, dynamic> postParams = { Map<String, dynamic> postParams = {"UpdateItemTypeList": itemList};
"UpdateItemTypeList": itemList
};
postParams.addAll(AppState().postParamsJson); postParams.addAll(AppState().postParamsJson);
return await ApiClient().postJsonForObject((json) { return await ApiClient().postJsonForObject((json) {
GenericResponseModel responseData = GenericResponseModel.fromJson(json); GenericResponseModel responseData = GenericResponseModel.fromJson(json);
return responseData.updateUserItemTypesList; return responseData.updateUserItemTypesList;
}, url, postParams); }, url, postParams);
} }
} }

@ -1,6 +1,7 @@
import 'dart:io'; import 'dart:io';
import 'package:easy_localization/easy_localization.dart'; import 'package:easy_localization/easy_localization.dart';
import 'package:mohem_flutter_app/models/chat/get_user_login_token_model.dart';
import 'package:mohem_flutter_app/models/itg_forms_models/request_detail_model.dart'; import 'package:mohem_flutter_app/models/itg_forms_models/request_detail_model.dart';
import 'package:mohem_flutter_app/models/member_information_list_model.dart'; import 'package:mohem_flutter_app/models/member_information_list_model.dart';
import 'package:mohem_flutter_app/models/member_login_list_model.dart'; import 'package:mohem_flutter_app/models/member_login_list_model.dart';
@ -72,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
@ -116,4 +119,10 @@ class AppState {
int? itgWorkListIndex; int? itgWorkListIndex;
set setItgWorkListIndex(int? _itgWorkListIndex) => itgWorkListIndex = _itgWorkListIndex; set setItgWorkListIndex(int? _itgWorkListIndex) => itgWorkListIndex = _itgWorkListIndex;
UserAutoLoginModel? chatDetails;
set setchatUserDetails(UserAutoLoginModel details) => chatDetails = details;
UserAutoLoginModel? get getchatUserDetails => chatDetails;
} }

@ -65,10 +65,10 @@ extension EmailValidator on String {
style: TextStyle(fontSize: 13, fontWeight: FontWeight.w600, color: color ?? MyColors.darkTextColor, letterSpacing: -0.52, decoration: isUnderLine ? TextDecoration.underline : null), style: TextStyle(fontSize: 13, fontWeight: FontWeight.w600, color: color ?? MyColors.darkTextColor, letterSpacing: -0.52, decoration: isUnderLine ? TextDecoration.underline : null),
); );
Widget toText14({Color? color, bool isBold = false, FontWeight? weight, int? maxlines}) => Text( Widget toText14({Color? color, bool isUnderLine = false, bool isBold = false, FontWeight? weight, int? maxlines}) => Text(
this, this,
maxLines: maxlines, maxLines: maxlines,
style: TextStyle(color: color ?? MyColors.darkTextColor, fontSize: 14, letterSpacing: -0.48, fontWeight: weight ?? (isBold ? FontWeight.bold : FontWeight.w600)), style: TextStyle(color: color ?? MyColors.darkTextColor, fontSize: 14, letterSpacing: -0.48, fontWeight: weight ?? (isBold ? FontWeight.bold : FontWeight.w600), decoration: isUnderLine ? TextDecoration.underline : null),
); );
Widget toText16({Color? color, bool isUnderLine = false, bool isBold = false, int? maxlines}) => Text( Widget toText16({Color? color, bool isUnderLine = false, bool isBold = false, int? maxlines}) => Text(

@ -472,7 +472,18 @@ class CodegenLoader extends AssetLoader{
"reset_locale": "Reset Language", "reset_locale": "Reset Language",
"chat": "دردشة", "chat": "دردشة",
"mychats": "دردشاتي", "mychats": "دردشاتي",
"createNewChat": "Create New Chat" "createNewChat": "Create New Chat",
"advancedSearch": "بحث متقدم",
"openNot": "التبليغات المفتوحة",
"fyi": "تبليغات للعلم",
"toDo": "تبليغات الأعمال",
"all": "كل التبليغات",
"meNot": "تبليغات صادرة مني",
"view": "عرض",
"fromUserName": "من",
"sentDate": "تاريخ الإرسال",
"itemTypeDisplayName": "اسم العرض",
"none": "بدون"
}; };
static const Map<String,dynamic> en_US = { static const Map<String,dynamic> en_US = {
"mohemm": "Mohemm", "mohemm": "Mohemm",
@ -932,7 +943,18 @@ static const Map<String,dynamic> en_US = {
"reset_locale": "Reset Language", "reset_locale": "Reset Language",
"chat": "Chat", "chat": "Chat",
"mychats": "My Chats", "mychats": "My Chats",
"createNewChat": "Create New Chat" "createNewChat": "Create New Chat",
"advancedSearch": "Advanced Search",
"openNot": "Open Notifications",
"fyi": "FYI Notifications",
"toDo": "To Do Notifications",
"all": "All Notifications",
"meNot": "Notifications from Me",
"view": "View",
"fromUserName": "From User Name",
"sentDate": "Sent Date",
"itemTypeDisplayName": "Item Type Display Name",
"none": "None"
}; };
static const Map<String, Map<String,dynamic>> mapLocales = {"ar_SA": ar_SA, "en_US": en_US}; static const Map<String, Map<String,dynamic>> mapLocales = {"ar_SA": ar_SA, "en_US": en_US};
} }

@ -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 typeCurrentPasswordBelow = 'typeCurrentPasswordBelow'; static const typeCurrentPasswordBelow = 'typeCurrentPasswordBelow';
static const currentPassword = 'currentPassword'; static const currentPassword = 'currentPassword';
static const profile_reset_password_label = 'profile.reset_password.label'; static const profile_reset_password_label = 'profile.reset_password.label';
@ -443,5 +445,16 @@ abstract class LocaleKeys {
static const chat = 'chat'; static const chat = 'chat';
static const mychats = 'mychats'; static const mychats = 'mychats';
static const createNewChat = 'createNewChat'; static const createNewChat = 'createNewChat';
static const advancedSearch = 'advancedSearch';
static const openNot = 'openNot';
static const fyi = 'fyi';
static const toDo = 'toDo';
static const all = 'all';
static const meNot = 'meNot';
static const view = 'view';
static const fromUserName = 'fromUserName';
static const sentDate = 'sentDate';
static const itemTypeDisplayName = 'itemTypeDisplayName';
static const none = 'none';
} }

@ -0,0 +1,78 @@
import 'dart:convert';
UserAutoLoginModel userAutoLoginModelFromJson(String str) => UserAutoLoginModel.fromJson(json.decode(str));
String userAutoLoginModelToJson(UserAutoLoginModel data) => json.encode(data.toJson());
class UserAutoLoginModel {
UserAutoLoginModel({
this.response,
this.errorResponses,
});
Response? response;
dynamic? errorResponses;
factory UserAutoLoginModel.fromJson(Map<String, dynamic> json) => UserAutoLoginModel(
response: json["response"] == null ? null : Response.fromJson(json["response"]),
errorResponses: json["errorResponses"],
);
Map<String, dynamic> toJson() => {
"response": response == null ? null : response!.toJson(),
"errorResponses": errorResponses,
};
}
class Response {
Response({
this.id,
this.userName,
this.email,
this.phone,
this.title,
this.token,
this.isDomainUser,
this.isActiveCode,
this.encryptedUserId,
this.encryptedUserName,
});
int? id;
String? userName;
String? email;
String? phone;
String? title;
String? token;
bool? isDomainUser;
bool? isActiveCode;
String? encryptedUserId;
String? encryptedUserName;
factory Response.fromJson(Map<String, dynamic> json) => Response(
id: json["id"] == null ? null : json["id"],
userName: json["userName"] == null ? null : json["userName"],
email: json["email"] == null ? null : json["email"],
phone: json["phone"] == null ? null : json["phone"],
title: json["title"] == null ? null : json["title"],
token: json["token"] == null ? null : json["token"],
isDomainUser: json["isDomainUser"] == null ? null : json["isDomainUser"],
isActiveCode: json["isActiveCode"] == null ? null : json["isActiveCode"],
encryptedUserId: json["encryptedUserId"] == null ? null : json["encryptedUserId"],
encryptedUserName: json["encryptedUserName"] == null ? null : json["encryptedUserName"],
);
Map<String, dynamic> toJson() => {
"id": id == null ? null : id,
"userName": userName == null ? null : userName,
"email": email == null ? null : email,
"phone": phone == null ? null : phone,
"title": title == null ? null : title,
"token": token == null ? null : token,
"isDomainUser": isDomainUser == null ? null : isDomainUser,
"isActiveCode": isActiveCode == null ? null : isActiveCode,
"encryptedUserId": encryptedUserId == null ? null : encryptedUserId,
"encryptedUserName": encryptedUserName == null ? null : encryptedUserName,
};
}

@ -28,6 +28,7 @@ import 'package:mohem_flutter_app/models/get_mobile_login_info_list_model.dart';
import 'package:mohem_flutter_app/models/get_notification_buttons_list_model.dart'; import 'package:mohem_flutter_app/models/get_notification_buttons_list_model.dart';
import 'package:mohem_flutter_app/models/get_po_Item_history_list_model.dart'; import 'package:mohem_flutter_app/models/get_po_Item_history_list_model.dart';
import 'package:mohem_flutter_app/models/get_po_notification_body_list_model.dart'; import 'package:mohem_flutter_app/models/get_po_notification_body_list_model.dart';
import 'package:mohem_flutter_app/models/get_pr_notification_body_list_model.dart';
import 'package:mohem_flutter_app/models/get_quotation_analysis_list_model.dart'; import 'package:mohem_flutter_app/models/get_quotation_analysis_list_model.dart';
import 'package:mohem_flutter_app/models/get_schedule_shifts_details_list_model.dart'; import 'package:mohem_flutter_app/models/get_schedule_shifts_details_list_model.dart';
import 'package:mohem_flutter_app/models/get_stamp_ms_notification_body_list_model.dart'; import 'package:mohem_flutter_app/models/get_stamp_ms_notification_body_list_model.dart';
@ -220,7 +221,7 @@ class GenericResponseModel {
List<GetPhonesNotificationBodyList>? getPhonesNotificationBodyList; List<GetPhonesNotificationBodyList>? getPhonesNotificationBodyList;
List<GetPoItemHistoryList>? getPoItemHistoryList; List<GetPoItemHistoryList>? getPoItemHistoryList;
GetPoNotificationBodyList? getPoNotificationBodyList; GetPoNotificationBodyList? getPoNotificationBodyList;
List<String>? getPrNotificationBodyList; GetPrNotificationBodyList? getPrNotificationBodyList;
List<GetQuotationAnalysisList>? getQuotationAnalysisList; List<GetQuotationAnalysisList>? getQuotationAnalysisList;
List<String>? getRFCEmployeeListList; List<String>? getRFCEmployeeListList;
List<String>? getRespondAttributeValueList; List<String>? getRespondAttributeValueList;
@ -966,7 +967,7 @@ class GenericResponseModel {
}); });
} }
getPoNotificationBodyList = json['GetPoNotificationBodyList'] != null ? GetPoNotificationBodyList.fromJson(json['GetPoNotificationBodyList']) : null; getPoNotificationBodyList = json['GetPoNotificationBodyList'] != null ? GetPoNotificationBodyList.fromJson(json['GetPoNotificationBodyList']) : null;
getPrNotificationBodyList = json['GetPrNotificationBodyList']; getPrNotificationBodyList = json['GetPrNotificationBodyList'] != null ? GetPrNotificationBodyList.fromJson(json['GetPrNotificationBodyList']) : null;
if (json['GetQuotationAnalysisList'] != null) { if (json['GetQuotationAnalysisList'] != null) {
getQuotationAnalysisList = <GetQuotationAnalysisList>[]; getQuotationAnalysisList = <GetQuotationAnalysisList>[];
json['GetQuotationAnalysisList'].forEach((v) { json['GetQuotationAnalysisList'].forEach((v) {
@ -1575,7 +1576,10 @@ class GenericResponseModel {
if (this.getPoNotificationBodyList != null) { if (this.getPoNotificationBodyList != null) {
data['GetPoNotificationBodyList'] = this.getPoNotificationBodyList!.toJson(); data['GetPoNotificationBodyList'] = this.getPoNotificationBodyList!.toJson();
} }
data['GetPrNotificationBodyList'] = this.getPrNotificationBodyList; if (this.getPrNotificationBodyList != null) {
data['GetPrNotificationBodyList'] = this.getPrNotificationBodyList!.toJson();
}
if (this.getQuotationAnalysisList != null) { if (this.getQuotationAnalysisList != null) {
data['GetQuotationAnalysisList'] = this.getQuotationAnalysisList!.map((v) => v.toJson()).toList(); data['GetQuotationAnalysisList'] = this.getQuotationAnalysisList!.map((v) => v.toJson()).toList();
} }

@ -150,8 +150,8 @@ class POLines {
String? iTEMCODE; String? iTEMCODE;
String? iTEMDESCRIPTION; String? iTEMDESCRIPTION;
int? iTEMID; int? iTEMID;
int? lINEAMOUNT; num? lINEAMOUNT;
int? lINEDISCPERCENTAGE; num? lINEDISCPERCENTAGE;
int? lINENUM; int? lINENUM;
String? lINETYPE; String? lINETYPE;
String? mFG; String? mFG;

@ -0,0 +1,130 @@
class GetPrNotificationBodyList {
List<PRHeader>? pRHeader;
List<PRLines>? pRLines;
String? pCURRENCYCODE;
String? pINFORMATION;
String? pQUESTION;
GetPrNotificationBodyList(
{this.pRHeader,
this.pRLines,
this.pCURRENCYCODE,
this.pINFORMATION,
this.pQUESTION});
GetPrNotificationBodyList.fromJson(Map<String, dynamic> json) {
if (json['PRHeader'] != null) {
pRHeader = <PRHeader>[];
json['PRHeader'].forEach((v) {
pRHeader!.add(new PRHeader.fromJson(v));
});
}
if (json['PRLines'] != null) {
pRLines = <PRLines>[];
json['PRLines'].forEach((v) {
pRLines!.add(new PRLines.fromJson(v));
});
}
pCURRENCYCODE = json['P_CURRENCY_CODE'];
pINFORMATION = json['P_INFORMATION'];
pQUESTION = json['P_QUESTION'];
}
Map<String, dynamic> toJson() {
Map<String, dynamic> data = new Map<String, dynamic>();
if (this.pRHeader != null) {
data['PRHeader'] = this.pRHeader!.map((v) => v.toJson()).toList();
}
if (this.pRLines != null) {
data['PRLines'] = this.pRLines!.map((v) => v.toJson()).toList();
}
data['P_CURRENCY_CODE'] = this.pCURRENCYCODE;
data['P_INFORMATION'] = this.pINFORMATION;
data['P_QUESTION'] = this.pQUESTION;
return data;
}
}
class PRHeader {
String? hDRATTRIBUTENAME;
String? hDRATTRIBUTEVALUE;
PRHeader({this.hDRATTRIBUTENAME, this.hDRATTRIBUTEVALUE});
PRHeader.fromJson(Map<String, dynamic> json) {
hDRATTRIBUTENAME = json['HDR_ATTRIBUTE_NAME'];
hDRATTRIBUTEVALUE = json['HDR_ATTRIBUTE_VALUE'];
}
Map<String, dynamic> toJson() {
Map<String, dynamic> data = new Map<String, dynamic>();
data['HDR_ATTRIBUTE_NAME'] = this.hDRATTRIBUTENAME;
data['HDR_ATTRIBUTE_VALUE'] = this.hDRATTRIBUTEVALUE;
return data;
}
}
class PRLines {
String? cOSTCENTER;
String? dESCRIPTION;
int? fROMROWNUM;
int? iTEMAMU;
String? iTEMCODE;
num? lINEAMOUNT;
int? lINENUM;
int? nOOFROWS;
int? qUANTITY;
int? rOWNUM;
int? tOROWNUM;
num? uNITPRICE;
String? uOM;
PRLines(
{this.cOSTCENTER,
this.dESCRIPTION,
this.fROMROWNUM,
this.iTEMAMU,
this.iTEMCODE,
this.lINEAMOUNT,
this.lINENUM,
this.nOOFROWS,
this.qUANTITY,
this.rOWNUM,
this.tOROWNUM,
this.uNITPRICE,
this.uOM});
PRLines.fromJson(Map<String, dynamic> json) {
cOSTCENTER = json['COST_CENTER'];
dESCRIPTION = json['DESCRIPTION'];
fROMROWNUM = json['FROM_ROW_NUM'];
iTEMAMU = json['ITEM_AMU'];
iTEMCODE = json['ITEM_CODE'];
lINEAMOUNT = json['LINE_AMOUNT'];
lINENUM = json['LINE_NUM'];
nOOFROWS = json['NO_OF_ROWS'];
qUANTITY = json['QUANTITY'];
rOWNUM = json['ROW_NUM'];
tOROWNUM = json['TO_ROW_NUM'];
uNITPRICE = json['UNIT_PRICE'];
uOM = json['UOM'];
}
Map<String, dynamic> toJson() {
Map<String, dynamic> data = new Map<String, dynamic>();
data['COST_CENTER'] = this.cOSTCENTER;
data['DESCRIPTION'] = this.dESCRIPTION;
data['FROM_ROW_NUM'] = this.fROMROWNUM;
data['ITEM_AMU'] = this.iTEMAMU;
data['ITEM_CODE'] = this.iTEMCODE;
data['LINE_AMOUNT'] = this.lINEAMOUNT;
data['LINE_NUM'] = this.lINENUM;
data['NO_OF_ROWS'] = this.nOOFROWS;
data['QUANTITY'] = this.qUANTITY;
data['ROW_NUM'] = this.rOWNUM;
data['TO_ROW_NUM'] = this.tOROWNUM;
data['UNIT_PRICE'] = this.uNITPRICE;
data['UOM'] = this.uOM;
return data;
}
}

@ -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;

@ -433,6 +433,7 @@ class _AddVacationRuleScreenState extends State<AddVacationRuleScreen> {
child: SearchEmployeeBottomSheet( child: SearchEmployeeBottomSheet(
title: LocaleKeys.searchForEmployee.tr(), title: LocaleKeys.searchForEmployee.tr(),
apiMode: LocaleKeys.delegate.tr(), apiMode: LocaleKeys.delegate.tr(),
fromChat: false,
onSelectEmployee: (_selectedEmployee) { onSelectEmployee: (_selectedEmployee) {
// Navigator.pop(context); // Navigator.pop(context);
selectedReplacementEmployee = _selectedEmployee; selectedReplacementEmployee = _selectedEmployee;

@ -4,6 +4,7 @@ import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart'; import 'package:flutter_svg/flutter_svg.dart';
import 'package:mohem_flutter_app/api/chat/chat_provider_model.dart'; import 'package:mohem_flutter_app/api/chat/chat_provider_model.dart';
import 'package:mohem_flutter_app/app_state/app_state.dart';
import 'package:mohem_flutter_app/classes/colors.dart'; import 'package:mohem_flutter_app/classes/colors.dart';
import 'package:mohem_flutter_app/ui/chat/chat_bubble.dart'; import 'package:mohem_flutter_app/ui/chat/chat_bubble.dart';
import 'package:mohem_flutter_app/widgets/app_bar_widget.dart'; import 'package:mohem_flutter_app/widgets/app_bar_widget.dart';
@ -20,7 +21,7 @@ class ChatDetailScreen extends StatelessWidget {
Widget build(BuildContext context) { Widget build(BuildContext context) {
userDetails = ModalRoute.of(context)!.settings.arguments; userDetails = ModalRoute.of(context)!.settings.arguments;
data = Provider.of<ChatProviderModel>(context, listen: false); data = Provider.of<ChatProviderModel>(context, listen: false);
data.getSingleUserChatHistory(senderUID: "42062", receiverUID: userDetails["targetUser"].id, pagination: "0"); data.getSingleUserChatHistory(senderUID: AppState().chatDetails!.response!.id.toString(), receiverUID: userDetails["targetUser"].id, pagination: "0");
Timer(const Duration(seconds: 1), () => data.scrollDown()); Timer(const Duration(seconds: 1), () => data.scrollDown());
return Scaffold( return Scaffold(
backgroundColor: const Color(0xFFF8F8F8), backgroundColor: const Color(0xFFF8F8F8),
@ -70,6 +71,7 @@ class ChatDetailScreen extends StatelessWidget {
width: 35, width: 35,
), ),
onPressed: () { onPressed: () {
// m.logger.d(userDetails);
m.sendChatMessage(m.message.text, userDetails["targetUser"].id, userDetails["targetUser"].userName); m.sendChatMessage(m.message.text, userDetails["targetUser"].id, userDetails["targetUser"].userName);
}, },
), ),

@ -5,6 +5,7 @@ import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart'; import 'package:flutter_svg/flutter_svg.dart';
import 'package:mohem_flutter_app/api/chat/chat_provider_model.dart'; import 'package:mohem_flutter_app/api/chat/chat_provider_model.dart';
import 'package:mohem_flutter_app/app_state/app_state.dart';
import 'package:mohem_flutter_app/classes/colors.dart'; import 'package:mohem_flutter_app/classes/colors.dart';
import 'package:mohem_flutter_app/config/routes.dart'; import 'package:mohem_flutter_app/config/routes.dart';
import 'package:mohem_flutter_app/extensions/string_extensions.dart'; import 'package:mohem_flutter_app/extensions/string_extensions.dart';
@ -30,8 +31,9 @@ class _ChatHomeScreenState extends State<ChatHomeScreen> {
void initState() { void initState() {
super.initState(); super.initState();
data = Provider.of<ChatProviderModel>(context, listen: false); data = Provider.of<ChatProviderModel>(context, listen: false);
data.buildHubConnection(); data.getUserAutoLoginToken().whenComplete(() {
data.getUserRecentChats(); data.getUserRecentChats();
});
} }
@override @override
@ -115,7 +117,7 @@ class _ChatHomeScreenState extends State<ChatHomeScreen> {
Navigator.pushNamed( Navigator.pushNamed(
context, context,
AppRoutes.chatDetailed, AppRoutes.chatDetailed,
arguments: {"currentUser": "42062", "targetUser": m.searchedChats![index]}, arguments: {"targetUser": m.searchedChats![index]},
); );
}, },
); );
@ -161,6 +163,7 @@ class _ChatHomeScreenState extends State<ChatHomeScreen> {
child: SearchEmployeeBottomSheet( child: SearchEmployeeBottomSheet(
title: LocaleKeys.searchForEmployee.tr(), title: LocaleKeys.searchForEmployee.tr(),
apiMode: LocaleKeys.delegate.tr(), apiMode: LocaleKeys.delegate.tr(),
fromChat: true,
onSelectEmployee: (_selectedEmployee) { onSelectEmployee: (_selectedEmployee) {
// Navigator.pop(context); // Navigator.pop(context);
// selectedReplacementEmployee = _selectedEmployee; // selectedReplacementEmployee = _selectedEmployee;

@ -32,9 +32,9 @@ class EmployeeDigitialIdDialog extends StatelessWidget {
Container( Container(
width: 80, width: 80,
height: 80, height: 80,
decoration: BoxDecoration( decoration: const BoxDecoration(
color: Colors.white, color: Colors.white,
borderRadius: const BorderRadius.all(Radius.circular(12)), borderRadius: BorderRadius.all(Radius.circular(12)),
boxShadow: [BoxShadow(color: Colors.white60, blurRadius: 10, spreadRadius: 10)], boxShadow: [BoxShadow(color: Colors.white60, blurRadius: 10, spreadRadius: 10)],
), ),
clipBehavior: Clip.antiAlias, clipBehavior: Clip.antiAlias,
@ -44,7 +44,7 @@ class EmployeeDigitialIdDialog extends StatelessWidget {
child: SvgPicture.asset("assets/images/user.svg"), child: SvgPicture.asset("assets/images/user.svg"),
) )
: Image.memory( : Image.memory(
Utils.getPostBytes( Utils.dataFromBase64String(
AppState().memberInformationList!.eMPLOYEEIMAGE ?? "", AppState().memberInformationList!.eMPLOYEEIMAGE ?? "",
), ),
fit: BoxFit.cover, fit: BoxFit.cover,

@ -80,7 +80,7 @@ class _DashboardScreenState extends State<DashboardScreen> {
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: [ children: [
Image.memory( Image.memory(
Utils.getPostBytes( Utils.dataFromBase64String(
AppState().memberInformationList!.eMPLOYEEIMAGE ?? "", AppState().memberInformationList!.eMPLOYEEIMAGE ?? "",
), ),
errorBuilder: (BuildContext context, error, stackTrace) { errorBuilder: (BuildContext context, error, stackTrace) {
@ -162,18 +162,21 @@ class _DashboardScreenState extends State<DashboardScreen> {
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
LocaleKeys.markAttendance.tr().toText14(color: Colors.white, isBold: true), LocaleKeys.markAttendance.tr().toText14(color: Colors.white, isBold: true),
if (model.isTimeRemainingInSeconds == 0) "01-02-2022".toText12(color: Colors.white), if (model.isTimeRemainingInSeconds == 0) DateTime.now().toString().split(" ")[0].toText12(color: Colors.white),
if (model.isTimeRemainingInSeconds != 0) if (model.isTimeRemainingInSeconds != 0)
Column( Column(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
9.height, 9.height,
CountdownTimer( Directionality(
textDirection: TextDirection.ltr,
child: CountdownTimer(
endTime: model.endTime, endTime: model.endTime,
onEnd: null, onEnd: null,
endWidget: "00:00:00".toText14(color: Colors.white, isBold: true), endWidget: "00:00:00".toText14(color: Colors.white, isBold: true),
textStyle: TextStyle(color: Colors.white, fontSize: 14, letterSpacing: -0.48, fontWeight: FontWeight.bold), 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,
@ -414,7 +419,7 @@ class _DashboardScreenState extends State<DashboardScreen> {
"assets/icons/item_for_sale.svg", "assets/icons/item_for_sale.svg",
color: currentIndex == 3 ? MyColors.grey3AColor : MyColors.grey98Color, color: currentIndex == 3 ? MyColors.grey3AColor : MyColors.grey98Color,
).paddingAll(4), ).paddingAll(4),
label: LocaleKeys.chat.tr(), label: LocaleKeys.itemsForSale.tr(),
), ),
BottomNavigationBarItem( BottomNavigationBarItem(
icon: SvgPicture.asset( icon: SvgPicture.asset(

@ -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();
} }
@ -52,7 +56,7 @@ class _AppDrawerState extends State<AppDrawer> {
) )
: CircleAvatar( : CircleAvatar(
radius: 52 / 2, radius: 52 / 2,
backgroundImage: MemoryImage(Utils.getPostBytes(AppState().memberInformationList!.eMPLOYEEIMAGE)), backgroundImage: MemoryImage(Utils.dataFromBase64String(AppState().memberInformationList!.eMPLOYEEIMAGE!)),
backgroundColor: Colors.black, backgroundColor: Colors.black,
), ),
12.width, 12.width,
@ -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;

@ -76,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)
),
], ],
) )
], ],
@ -118,9 +114,8 @@ 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").toList() ?? []; List<GetMenuEntriesList> menuList = pro.getMenuEntriesList?.where((element) => element.parentMenuName == menuEntry.menuName && (element.menuEntryType == "FUNCTION")).toList() ?? [];
menuEntry.icon = ""; menuEntry.icon = "";
print(menuEntry.toJson());
if (menuList.isEmpty) { if (menuList.isEmpty) {
if (menuEntry.requestType == "EIT") { if (menuEntry.requestType == "EIT") {
Navigator.pushNamed(context, AppRoutes.dynamicScreen, arguments: DynamicListViewParams(menuEntry.prompt!, menuEntry.functionName!)); Navigator.pushNamed(context, AppRoutes.dynamicScreen, arguments: DynamicListViewParams(menuEntry.prompt!, menuEntry.functionName!));
@ -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;
} }

@ -109,14 +109,14 @@ class _AddLeaveBalanceScreenState extends State<AddLeaveBalanceScreen> {
} }
} }
await LeaveBalanceApiClient().validateAbsenceTransaction(selectedAbsenceType!.dESCFLEXCONTEXTCODE!, "HR_LOA_SS", selectedAbsenceType!.aBSENCEATTENDANCETYPEID!, await LeaveBalanceApiClient().validateAbsenceTransaction(selectedAbsenceType!.dESCFLEXCONTEXTCODE!, "HR_LOA_SS", selectedAbsenceType!.aBSENCEATTENDANCETYPEID!,
selectedReplacementEmployee!.userName!, DateUtil.getFormattedDate(startDateTime!, "MM/dd/yyyy"), DateUtil.getFormattedDate(endDateTime!, "MM/dd/yyyy"), -999, dffDataMap, selectedReplacementEmployee != null ? selectedReplacementEmployee!.userName! : "", DateUtil.getFormattedDate(startDateTime!, "MM/dd/yyyy"), DateUtil.getFormattedDate(endDateTime!, "MM/dd/yyyy"), -999, dffDataMap,
comments: comment); comments: comment);
SumbitAbsenceTransactionList submit = await LeaveBalanceApiClient().submitAbsenceTransaction( SumbitAbsenceTransactionList submit = await LeaveBalanceApiClient().submitAbsenceTransaction(
selectedAbsenceType!.dESCFLEXCONTEXTCODE!, selectedAbsenceType!.dESCFLEXCONTEXTCODE!,
"HR_LOA_SS", "HR_LOA_SS",
selectedAbsenceType!.aBSENCEATTENDANCETYPEID!, selectedAbsenceType!.aBSENCEATTENDANCETYPEID!,
selectedReplacementEmployee!.userName!, selectedReplacementEmployee != null ? selectedReplacementEmployee!.userName! : "",
DateUtil.getFormattedDate(startDateTime!, "MM/dd/yyyy"), DateUtil.getFormattedDate(startDateTime!, "MM/dd/yyyy"),
DateUtil.getFormattedDate(endDateTime!, "MM/dd/yyyy"), DateUtil.getFormattedDate(endDateTime!, "MM/dd/yyyy"),
-999, -999,
@ -126,9 +126,9 @@ class _AddLeaveBalanceScreenState extends State<AddLeaveBalanceScreen> {
Utils.hideLoading(context); Utils.hideLoading(context);
await Navigator.pushNamed(context, AppRoutes.requestSubmitScreen, arguments: RequestSubmitScreenParams(LocaleKeys.submit.tr(), submit.pTRANSACTIONID!, "", "add_leave_balance")); await Navigator.pushNamed(context, AppRoutes.requestSubmitScreen, arguments: RequestSubmitScreenParams(LocaleKeys.submit.tr(), submit.pTRANSACTIONID!, "", "add_leave_balance"));
Utils.showLoading(context); // Utils.showLoading(context);
await LeaveBalanceApiClient().cancelHrTransaction(submit.pTRANSACTIONID!); await LeaveBalanceApiClient().cancelHrTransaction(submit.pTRANSACTIONID!);
Utils.hideLoading(context); // Utils.hideLoading(context);
} catch (ex) { } catch (ex) {
Utils.hideLoading(context); Utils.hideLoading(context);
Utils.handleException(ex, context, null); Utils.handleException(ex, context, null);
@ -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) {
@ -224,6 +224,7 @@ class _AddLeaveBalanceScreenState extends State<AddLeaveBalanceScreen> {
child: SearchEmployeeBottomSheet( child: SearchEmployeeBottomSheet(
title: LocaleKeys.searchForEmployee.tr(), title: LocaleKeys.searchForEmployee.tr(),
apiMode: LocaleKeys.delegate.tr(), apiMode: LocaleKeys.delegate.tr(),
fromChat: false,
onSelectEmployee: (_selectedEmployee) { onSelectEmployee: (_selectedEmployee) {
// Navigator.pop(context); // Navigator.pop(context);
selectedReplacementEmployee = _selectedEmployee; selectedReplacementEmployee = _selectedEmployee;

@ -5,6 +5,7 @@ import 'package:easy_localization/src/public_ext.dart';
import 'package:firebase_core/firebase_core.dart'; import 'package:firebase_core/firebase_core.dart';
import 'package:firebase_messaging/firebase_messaging.dart'; import 'package:firebase_messaging/firebase_messaging.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:mohem_flutter_app/api/login_api_client.dart'; import 'package:mohem_flutter_app/api/login_api_client.dart';
@ -129,14 +130,14 @@ class _LoginScreenState extends State<LoginScreen> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
if (isAppOpenBySystem == null) { if (isAppOpenBySystem == null) {
isAppOpenBySystem = (ModalRoute.of(context)!.settings.arguments ?? true) as bool; isAppOpenBySystem = (ModalRoute.of(context)!.settings.arguments ?? true) as bool;
if (kDebugMode) {
// username.text = "15153"; // username.text = "15444"; // Maha User
// password.text = "Abcd@12345"; username.text = "15153"; // Tamer User
password.text = "Abcd@12345";
}
if (isAppOpenBySystem!) checkFirebaseToken(); if (isAppOpenBySystem!) checkFirebaseToken();
} }
// username.text = "15444";
return Scaffold( return Scaffold(
body: Column( body: Column(
children: [ children: [

@ -8,8 +8,10 @@ import 'package:mohem_flutter_app/extensions/int_extensions.dart';
import 'package:mohem_flutter_app/extensions/string_extensions.dart'; import 'package:mohem_flutter_app/extensions/string_extensions.dart';
import 'package:mohem_flutter_app/extensions/widget_extensions.dart'; import 'package:mohem_flutter_app/extensions/widget_extensions.dart';
import 'package:mohem_flutter_app/models/dashboard/menu_entries.dart'; import 'package:mohem_flutter_app/models/dashboard/menu_entries.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/dynamic_screens/dynamic_listview_screen.dart';
import 'package:mohem_flutter_app/widgets/app_bar_widget.dart'; import 'package:mohem_flutter_app/widgets/app_bar_widget.dart';
import 'package:provider/provider.dart';
class ServicesMenuListScreenParams { class ServicesMenuListScreenParams {
final String title; final String title;
@ -29,10 +31,7 @@ class ServicesMenuListScreen extends StatelessWidget {
return Scaffold( return Scaffold(
backgroundColor: Colors.white, backgroundColor: Colors.white,
appBar: AppBarWidget( appBar: AppBarWidget(context, title: servicesMenuData.title),
context,
title: servicesMenuData.title,
),
body: SizedBox( body: SizedBox(
width: double.infinity, width: double.infinity,
height: double.infinity, height: double.infinity,
@ -60,8 +59,12 @@ class ServicesMenuListScreen extends StatelessWidget {
Navigator.pushNamed(context, AppRoutes.dynamicScreen, arguments: DynamicListViewParams(servicesMenuData.list[index].prompt!, servicesMenuData.list[index].functionName!)); Navigator.pushNamed(context, AppRoutes.dynamicScreen, arguments: DynamicListViewParams(servicesMenuData.list[index].prompt!, servicesMenuData.list[index].functionName!));
} else { } else {
if (servicesMenuData.list[index].requestType == "TERMINATION") { if (servicesMenuData.list[index].requestType == "TERMINATION") {
Navigator.pushNamed(context, AppRoutes.endEmploymentScreen, arguments: DynamicListViewParams(servicesMenuData.list[index].prompt!, servicesMenuData.list[index].functionName!)); Navigator.pushNamed(context, AppRoutes.endEmploymentScreen,
arguments: DynamicListViewParams(servicesMenuData.list[index].prompt!, servicesMenuData.list[index].functionName!));
} else {
var provider = Provider.of<DashboardProviderModel>(context, listen: false);
List<GetMenuEntriesList> menuList = provider.getMenuEntriesList?.where((element) => element.parentMenuName == servicesMenuData.list[index].menuName).toList() ?? [];
Navigator.pushNamed(context, AppRoutes.servicesMenuListScreen, arguments: ServicesMenuListScreenParams(servicesMenuData.list[index].prompt!, menuList));
} }
} }
}), }),

@ -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,
); );
} }

@ -189,7 +189,7 @@ class _AddItemDetailsFragmentState extends State<AddItemDetailsFragment> {
title.toText16().expanded, title.toText16().expanded,
6.width, 6.width,
SimpleButton(LocaleKeys.add.tr(), () { SimpleButton(LocaleKeys.add.tr(), () {
ImageOptions.showImageOptionsNew(context, (String image, File file) { ImageOptions.showImageOptionsNew(context, false, (String image, File file) {
setState(() { setState(() {
images.add(image); images.add(image);
Navigator.of(context).pop(); Navigator.of(context).pop();
@ -272,15 +272,15 @@ class _AddItemDetailsFragmentState extends State<AddItemDetailsFragment> {
} }
void getRegions() async { void getRegions() async {
// try { try {
Utils.showLoading(context); Utils.showLoading(context);
getRegionsList = await ItemsForSaleApiClient().getRegions(); getRegionsList = await ItemsForSaleApiClient().getRegions();
await getAdDetails(); await getAdDetails();
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);
// } }
} }
} }

@ -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;
@ -259,7 +259,8 @@ class _ItgDetailScreenState extends State<ItgDetailScreen> {
void handleFabAction(AllowedActions action) { void handleFabAction(AllowedActions action) {
switch (action.action) { switch (action.action) {
case "DELEGATE": case "DELEGATE":
// do something // showMyBottomSheet(context, child: DelegateSheet(title: LocaleKeys.delegate.tr(), apiMode: action.action!, notificationID: workListData!.nOTIFICATIONID, actionHistoryList: actionHistoryList));
break; break;
case "REQUEST_INFO": case "REQUEST_INFO":
// do something else // do something else
@ -355,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");
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"); 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);
@ -368,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");
AppState().workList!.removeAt(AppState().workListIndex!);
if (AppState().workList!.isEmpty) {
Navigator.pop(context, "delegate_reload"); 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);

@ -12,6 +12,7 @@ import 'package:mohem_flutter_app/extensions/widget_extensions.dart';
import 'package:mohem_flutter_app/generated/locale_keys.g.dart'; import 'package:mohem_flutter_app/generated/locale_keys.g.dart';
import 'package:mohem_flutter_app/models/generic_response_model.dart'; import 'package:mohem_flutter_app/models/generic_response_model.dart';
import 'package:mohem_flutter_app/models/get_action_history_list_model.dart'; import 'package:mohem_flutter_app/models/get_action_history_list_model.dart';
import 'package:mohem_flutter_app/models/itg_forms_models/wf_history_model.dart';
import 'package:mohem_flutter_app/models/worklist/get_favorite_replacements_model.dart'; import 'package:mohem_flutter_app/models/worklist/get_favorite_replacements_model.dart';
import 'package:mohem_flutter_app/models/worklist/replacement_list_model.dart'; import 'package:mohem_flutter_app/models/worklist/replacement_list_model.dart';
import 'package:mohem_flutter_app/ui/work_list/sheets/search_options_sheet.dart'; import 'package:mohem_flutter_app/ui/work_list/sheets/search_options_sheet.dart';
@ -25,8 +26,9 @@ class DelegateSheet extends StatefulWidget {
int? notificationID; int? notificationID;
String title, apiMode; String title, apiMode;
List<GetActionHistoryList>? actionHistoryList; List<GetActionHistoryList>? actionHistoryList;
List<WFHistory>? wFHistory;
DelegateSheet({required this.title, required this.apiMode, this.notificationID, this.actionHistoryList}); DelegateSheet({required this.title, required this.apiMode, this.notificationID, this.actionHistoryList,this.wFHistory});
@override @override
State<DelegateSheet> createState() => _DelegateSheetState(); State<DelegateSheet> createState() => _DelegateSheetState();
@ -204,7 +206,7 @@ class _DelegateSheetState extends State<DelegateSheet> {
onPressed: () { onPressed: () {
fetchUserByInput(); fetchUserByInput();
}, },
child: Text( child: const Text(
"Search", "Search",
style: TextStyle( style: TextStyle(
color: Colors.blue, color: Colors.blue,

@ -85,6 +85,7 @@ class SelectedItemSheet extends StatelessWidget {
child: DefaultButton( child: DefaultButton(
LocaleKeys.submit.tr(), LocaleKeys.submit.tr(),
() { () {
if (comment.trim() != "") {
String? email = "", userId = ""; String? email = "", userId = "";
if (actionHistoryList != null) { if (actionHistoryList != null) {
email = actionHistoryList!.eMAILADDRESS; email = actionHistoryList!.eMAILADDRESS;
@ -97,8 +98,11 @@ class SelectedItemSheet extends StatelessWidget {
userId = replacementList!.userName; userId = replacementList!.userName;
} }
performNetworkCall(context, email: email ?? "", userId: userId ?? ""); performNetworkCall(context, email: email ?? "", userId: userId ?? "");
} else {
Utils.showToast("Please enter comments");
}
}, },
colors: [ colors: const [
Color(0xff32D892), Color(0xff32D892),
Color(0xff1AB170), Color(0xff1AB170),
], ],

@ -1,4 +1,5 @@
import 'package:easy_localization/src/public_ext.dart'; import 'package:easy_localization/src/public_ext.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_svg/svg.dart'; import 'package:flutter_svg/svg.dart';
import 'package:mohem_flutter_app/api/worklist/worklist_api_client.dart'; import 'package:mohem_flutter_app/api/worklist/worklist_api_client.dart';
@ -18,6 +19,8 @@ import 'package:mohem_flutter_app/models/worklist_item_type_model.dart';
import 'package:mohem_flutter_app/models/worklist_response_model.dart'; import 'package:mohem_flutter_app/models/worklist_response_model.dart';
import 'package:mohem_flutter_app/provider/dashboard_provider_model.dart'; import 'package:mohem_flutter_app/provider/dashboard_provider_model.dart';
import 'package:mohem_flutter_app/widgets/app_bar_widget.dart'; import 'package:mohem_flutter_app/widgets/app_bar_widget.dart';
import 'package:mohem_flutter_app/widgets/bottom_sheet.dart';
import 'package:mohem_flutter_app/widgets/bottom_sheets/worklist_advance_search_bottom_sheet.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart'; import 'package:pull_to_refresh/pull_to_refresh.dart';
@ -87,6 +90,10 @@ class _WorkListScreenState extends State<WorkListScreen> {
final RefreshController _refreshController = RefreshController(initialRefresh: false); final RefreshController _refreshController = RefreshController(initialRefresh: false);
final ScrollController _controller = ScrollController();
int pNotificationType = 1;
@override @override
void initState() { void initState() {
super.initState(); super.initState();
@ -132,7 +139,7 @@ class _WorkListScreenState extends State<WorkListScreen> {
} }
} else { } else {
itgRequestTypeIndex = null; itgRequestTypeIndex = null;
workList = await WorkListApiClient().getWorkList(pageNumber, workListItemTypes[workListItemIndex].key); workList = await WorkListApiClient().getWorkList(pageNumber, workListItemTypes[workListItemIndex].key, pNotificationType.toString());
AppState().setWorkList = workList; AppState().setWorkList = workList;
} }
if (showLoading) Utils.hideLoading(context); if (showLoading) Utils.hideLoading(context);
@ -152,6 +159,7 @@ class _WorkListScreenState extends State<WorkListScreen> {
getWorkList(showLoading: false), getWorkList(showLoading: false),
]); ]);
calculateCounter(); calculateCounter();
Utils.hideLoading(context);
setState(() {}); setState(() {});
} catch (ex) { } catch (ex) {
Utils.hideLoading(context); Utils.hideLoading(context);
@ -183,6 +191,7 @@ class _WorkListScreenState extends State<WorkListScreen> {
SizedBox( SizedBox(
height: 40, height: 40,
child: ListView.separated( child: ListView.separated(
controller: _controller,
itemBuilder: (context, index) { itemBuilder: (context, index) {
return Container( return Container(
padding: const EdgeInsets.only(left: 21, right: 21, top: 8, bottom: 8), padding: const EdgeInsets.only(left: 21, right: 21, top: 8, bottom: 8),
@ -191,6 +200,9 @@ class _WorkListScreenState extends State<WorkListScreen> {
child: ("${workListItemTypes[index].name} ${workListItemTypes[index].value > 0 ? "(${workListItemTypes[index].value})" : ""}") child: ("${workListItemTypes[index].name} ${workListItemTypes[index].value > 0 ? "(${workListItemTypes[index].value})" : ""}")
.toText12(color: workListItemIndex == index ? MyColors.white : MyColors.black), .toText12(color: workListItemIndex == index ? MyColors.white : MyColors.black),
).onPress(() { ).onPress(() {
if (pNotificationType != 1) {
pNotificationType = 1;
}
if (workListItemIndex != index && !workListItemTypes[index].disable) { if (workListItemIndex != index && !workListItemTypes[index].disable) {
workListItemIndex = index; workListItemIndex = index;
if (workListItemTypes[index].value == 0) { if (workListItemTypes[index].value == 0) {
@ -213,7 +225,15 @@ class _WorkListScreenState extends State<WorkListScreen> {
padding: const EdgeInsets.only(left: 21, right: 21), padding: const EdgeInsets.only(left: 21, right: 21),
), ),
).paddingOnly(top: 21, bottom: 21), ).paddingOnly(top: 21, bottom: 21),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
workListItemTypes[workListItemIndex].fullName.toSectionHeading().paddingOnly(left: 21, right: 21), workListItemTypes[workListItemIndex].fullName.toSectionHeading().paddingOnly(left: 21, right: 21),
LocaleKeys.advancedSearch.tr().toText14(isUnderLine: true, color: MyColors.textMixColor).onPress(() {
openBottomSheet(context);
}).paddingOnly(left: 21, right: 21)
],
),
SmartRefresher( SmartRefresher(
enablePullDown: true, enablePullDown: true,
enablePullUp: false, enablePullUp: false,
@ -364,6 +384,38 @@ class _WorkListScreenState extends State<WorkListScreen> {
); );
} }
void openBottomSheet(BuildContext context) {
showMyBottomSheet(
context,
child: WorkListAdvanceSearch((selectedViewID, selectedItemTypeID, searchByInput, searchByDate) async {
itgRequestTypeIndex = null;
pNotificationType = selectedViewID;
int index = -1;
for (int i = 0; i < workListItemTypes.length; i++) {
if (workListItemTypes[i].key == selectedItemTypeID) {
index = i;
break;
}
}
Utils.showLoading(context);
workList = await WorkListApiClient().getWorkList(
pageNumber,
selectedItemTypeID,
selectedViewID.toString(),
pSearchUser: searchByInput,
pSearchSubject: searchByInput,
pSentDate: searchByDate,
pSearchItemType: searchByInput,
);
workListItemIndex = index;
AppState().setWorkList = workList;
Utils.hideLoading(context);
_animateToIndex(index, 50.0);
setState(() {});
}),
);
}
Widget rowItem(WorkListItemTypeModelData data, WorkListResponseModel workData, int index) { Widget rowItem(WorkListItemTypeModelData data, WorkListResponseModel workData, int index) {
return InkWell( return InkWell(
onTap: () async { onTap: () async {
@ -390,6 +442,8 @@ class _WorkListScreenState extends State<WorkListScreen> {
calculateCounter(); calculateCounter();
if (mounted) setState(() {}); if (mounted) setState(() {});
} }
} else {
if (mounted) setState(() {});
} }
}, },
child: Container( child: Container(
@ -442,4 +496,12 @@ class _WorkListScreenState extends State<WorkListScreen> {
), ),
); );
} }
void _animateToIndex(int index, double width) {
_controller.animateTo(
index * width,
duration: const Duration(seconds: 1),
curve: Curves.fastOutSlowIn,
);
}
} }

@ -1,5 +1,3 @@
import 'dart:convert';
import 'package:easy_localization/src/public_ext.dart'; import 'package:easy_localization/src/public_ext.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_svg/svg.dart'; import 'package:flutter_svg/svg.dart';
@ -19,6 +17,7 @@ import 'package:mohem_flutter_app/models/get_item_creation_ntf_body_list_model.d
import 'package:mohem_flutter_app/models/get_mo_notification_body_list_model.dart'; import 'package:mohem_flutter_app/models/get_mo_notification_body_list_model.dart';
import 'package:mohem_flutter_app/models/get_notification_buttons_list_model.dart'; import 'package:mohem_flutter_app/models/get_notification_buttons_list_model.dart';
import 'package:mohem_flutter_app/models/get_po_notification_body_list_model.dart'; import 'package:mohem_flutter_app/models/get_po_notification_body_list_model.dart';
import 'package:mohem_flutter_app/models/get_pr_notification_body_list_model.dart';
import 'package:mohem_flutter_app/models/get_stamp_ms_notification_body_list_model.dart'; import 'package:mohem_flutter_app/models/get_stamp_ms_notification_body_list_model.dart';
import 'package:mohem_flutter_app/models/get_stamp_ns_notification_body_list_model.dart'; import 'package:mohem_flutter_app/models/get_stamp_ns_notification_body_list_model.dart';
import 'package:mohem_flutter_app/models/member_information_list_model.dart'; import 'package:mohem_flutter_app/models/member_information_list_model.dart';
@ -76,6 +75,7 @@ class _WorkListDetailScreenState extends State<WorkListDetailScreen> {
GenericResponseModel? getICBody; GenericResponseModel? getICBody;
GenericResponseModel? subordinatesLeavesModel; GenericResponseModel? subordinatesLeavesModel;
GetPoNotificationBodyList? getPoNotificationBody; GetPoNotificationBodyList? getPoNotificationBody;
GetPrNotificationBodyList? getPrNotificationBody;
GetItemCreationNtfBodyList? getItemCreationNtfBody; GetItemCreationNtfBodyList? getItemCreationNtfBody;
bool isCloseAvailable = false; bool isCloseAvailable = false;
@ -93,91 +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); // getBasicNTFBody = await WorkListApiClient().getBasicDetNTFBody(workListData!.nOTIFICATIONID!, -999);
// getAbsenceCollectionNotifications = await WorkListApiClient().getAbsenceNotificationBody(workListData!.nOTIFICATIONID!, -999); // getAbsenceCollectionNotifications = await WorkListApiClient().getAbsenceNotificationBody(workListData!.nOTIFICATIONID!, -999);
// subordinatesLeavesModel = await WorkListApiClient().getSubordinatesLeaves("", ""); // subordinatesLeavesModel = await WorkListApiClient().getSubordinatesLeaves("", "");
} }
if (workListData!.iTEMTYPE == "STAMP") { if (workListData!.iTEMTYPE == "STAMP") {
if (workListData!.rEQUESTTYPE == "STAMP_MS") { getStampNotificationBody();
getStampMsNotifications = await WorkListApiClient().getStampMsNotificationBody(workListData!.nOTIFICATIONID!, -999);
} else {
getStampNsNotifications = await WorkListApiClient().getStampNsNotificationBody(workListData!.nOTIFICATIONID!, -999);
}
} }
if (workListData!.iTEMTYPE == "INVMOA") { if (workListData!.iTEMTYPE == "INVMOA") {
getMoNotificationBodyList = await WorkListApiClient().getMoNotificationBody(workListData!.nOTIFICATIONID!, -999); getMoNotificationBody();
} }
if (workListData!.iTEMTYPE == "INVITEM") { if (workListData!.iTEMTYPE == "INVITEM") {
getItemCreationNtfBody = await WorkListApiClient().getItemCreationNtfBody(workListData!.nOTIFICATIONID!, -999); getItemCreationNtf();
} }
if (workListData!.iTEMTYPE == "POAPPRV") { if (workListData!.iTEMTYPE == "POAPPRV") {
getPoNotificationBody = await WorkListApiClient().getPoNotificationBody(workListData!.nOTIFICATIONID!, -999); getPoNotification();
} }
getNotificationRespondAttributes = await WorkListApiClient().notificationGetRespondAttributes(workListData!.nOTIFICATIONID!); if (workListData!.iTEMTYPE == "REQAPPRV") {
if (getNotificationRespondAttributes.isNotEmpty) { getPRNotification();
notificationNoteInput = getNotificationRespondAttributes.first;
} }
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 = [];
// //
// addRequestInFuture(notificationButtonsList, WorkListApiClient().getNotificationButtons(workListData!.nOTIFICATIONID!)); // WorkListApiClient().getActionHistory(workListData!.nOTIFICATIONID!),
// addRequestInFuture(actionHistoryList, WorkListApiClient().getActionHistory(workListData!.nOTIFICATIONID!)); // WorkListApiClient().getAttachments(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(() {});
// }
} }
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) {
@ -243,6 +229,7 @@ class _WorkListDetailScreenState extends State<WorkListDetailScreen> {
getBasicDetNtfBodyList: getBasicDetNtfBodyList, getBasicDetNtfBodyList: getBasicDetNtfBodyList,
getAbsenceCollectionNotificationBodyList: getAbsenceCollectionNotificationBodyList, getAbsenceCollectionNotificationBodyList: getAbsenceCollectionNotificationBodyList,
getContactNotificationBodyList: getContactNotificationBodyList, getContactNotificationBodyList: getContactNotificationBodyList,
getPrNotificationBodyList: getPrNotificationBody,
), ),
(workListData!.iTEMTYPE == "HRSSA" || workListData!.iTEMTYPE == "STAMP") (workListData!.iTEMTYPE == "HRSSA" || workListData!.iTEMTYPE == "STAMP")
? DetailFragment(workListData, memberInformationListModel) ? DetailFragment(workListData, memberInformationListModel)
@ -250,6 +237,7 @@ class _WorkListDetailScreenState extends State<WorkListDetailScreen> {
moNotificationBodyList: getMoNotificationBodyList, moNotificationBodyList: getMoNotificationBodyList,
poLinesList: getPoNotificationBody?.pOLines ?? [], poLinesList: getPoNotificationBody?.pOLines ?? [],
itemCreationLines: getItemCreationNtfBody?.itemCreationLines ?? [], itemCreationLines: getItemCreationNtfBody?.itemCreationLines ?? [],
prLinesList: getPrNotificationBody?.pRLines ?? [],
), ),
actionHistoryList.isEmpty ? Utils.getNoDataWidget(context) : ActionsFragment(workListData!.nOTIFICATIONID, actionHistoryList), actionHistoryList.isEmpty ? Utils.getNoDataWidget(context) : ActionsFragment(workListData!.nOTIFICATIONID, actionHistoryList),
getAttachmentList.isEmpty ? Utils.getNoDataWidget(context) : AttachmentsFragment(getAttachmentList), getAttachmentList.isEmpty ? Utils.getNoDataWidget(context) : AttachmentsFragment(getAttachmentList),
@ -319,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;
@ -376,33 +364,34 @@ class _WorkListDetailScreenState extends State<WorkListDetailScreen> {
void handleFabAction(GetNotificationButtonsList notificationButton) { void handleFabAction(GetNotificationButtonsList notificationButton) {
switch (notificationButton.bUTTONACTION) { switch (notificationButton.bUTTONACTION) {
case "DELEGATE": case "DELEGATE":
// do something showMyBottomSheet(context,
showMyBottomSheet(context, child: DelegateSheet(title: "Delegate", apiMode: "DELEGATE", notificationID: workListData!.nOTIFICATIONID, actionHistoryList: actionHistoryList)); child: DelegateSheet(title: LocaleKeys.delegate.tr(), apiMode: notificationButton.bUTTONACTION!, notificationID: workListData!.nOTIFICATIONID, actionHistoryList: actionHistoryList));
break; break;
case "REQUEST_INFO": case "REQUEST_INFO":
// do something else // do something else
showMyBottomSheet(context, child: DelegateSheet(title: "Request Info", apiMode: "REQUEST_INFO", notificationID: workListData!.nOTIFICATIONID, actionHistoryList: actionHistoryList)); showMyBottomSheet(context,
child: DelegateSheet(title: LocaleKeys.request_info.tr(), apiMode: "REQUEST_INFO", notificationID: workListData!.nOTIFICATIONID, actionHistoryList: actionHistoryList));
break; break;
case "RFC": case "RFC":
// do something else // do something else
break; break;
case "APPROVE":
performAction(notificationButton.bUTTONACTION!);
break;
case "UPDATE_ACTION": case "UPDATE_ACTION":
// do something else // do something else
case "APPROVE_AND_FORWARD": case "APPROVE_AND_FORWARD":
// do something else
showMyBottomSheet(context, showMyBottomSheet(context,
child: DelegateSheet(title: "Approve and Forward", apiMode: "APPROVE_AND_FORWARD", notificationID: workListData!.nOTIFICATIONID, actionHistoryList: actionHistoryList)); child: DelegateSheet(title: "Approve and Forward", apiMode: "APPROVE_AND_FORWARD", notificationID: workListData!.nOTIFICATIONID, actionHistoryList: actionHistoryList));
break; break;
case "FORWARD": case "FORWARD":
// do something else
showMyBottomSheet(context, child: DelegateSheet(title: "Forward", apiMode: "FORWARD", notificationID: workListData!.nOTIFICATIONID, actionHistoryList: actionHistoryList)); showMyBottomSheet(context, child: DelegateSheet(title: "Forward", apiMode: "FORWARD", notificationID: workListData!.nOTIFICATIONID, actionHistoryList: actionHistoryList));
break; break;
case "REJECT": case "REJECT":
// do something else
performNetworkCall(context, email: "", userId: ""); performNetworkCall(context, email: "", userId: "");
break; break;
case "RETURNED": case "RETURNED":
// do something else
Navigator.pop(context); Navigator.pop(context);
break; break;
} }
@ -482,7 +471,7 @@ class _WorkListDetailScreenState extends State<WorkListDetailScreen> {
child: isIconAsset child: isIconAsset
? SvgPicture.asset(icon) ? SvgPicture.asset(icon)
: Image.memory( : Image.memory(
base64Decode(icon), Utils.dataFromBase64String(icon),
fit: BoxFit.cover, fit: BoxFit.cover,
), ),
) )
@ -491,16 +480,19 @@ class _WorkListDetailScreenState extends State<WorkListDetailScreen> {
} }
void performAction(String actionMode) { void performAction(String actionMode) {
TextEditingController textEditingController = TextEditingController();
print("actionMode:$actionMode");
showDialog( showDialog(
context: context, context: context,
builder: (cxt) => AcceptRejectInputDialog( builder: (cxt) => AcceptRejectInputDialog(
message: LocaleKeys.requestedItems.tr(), message: LocaleKeys.requestedItems.tr(),
notificationGetRespond: notificationNoteInput, notificationGetRespond: notificationNoteInput,
textEditingController: textEditingController,
onTap: (note) { onTap: (note) {
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": "", "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": [
@ -511,7 +503,13 @@ class _WorkListDetailScreenState extends State<WorkListDetailScreen> {
} }
], ],
}; };
if (actionMode == "APPROVED" || actionMode == "APPROVE") {
performNotificationAction(payload);
} else if (note.isNotEmpty && (actionMode != "APPROVED" || actionMode != "APPROVE")) {
performNotificationAction(payload); performNotificationAction(payload);
} else {
Utils.showToast(LocaleKeys.pleaseEnterComments.tr());
}
}, },
), ),
); );
@ -523,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) {
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) { } catch (ex) {
apiCallCount--;
Utils.hideLoading(context); Utils.hideLoading(context);
Utils.handleException(ex, context, null); 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);
}
}
} }

@ -71,7 +71,9 @@ class ActionsFragment extends StatelessWidget {
Row( Row(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
CircularAvatar(url: actionHistory.eMPLOYEEIMAGE ?? "", isImageBase64: true, height: 34, width: 34), actionHistory.eMPLOYEEIMAGE != null
? CircularAvatar(url: actionHistory.eMPLOYEEIMAGE ?? "", isImageBase64: true, height: 34, width: 34)
: CircularAvatar(url: "https://cdn4.iconfinder.com/data/icons/professions-2-2/151/89-512.png", isImageBase64: false, height: 34, width: 34),
9.width, 9.width,
Expanded( Expanded(
child: Column( child: Column(
@ -129,10 +131,10 @@ class ActionsFragment extends StatelessWidget {
return MyColors.redColor; return MyColors.redColor;
} else if (code == "PENDING") { } else if (code == "PENDING") {
return MyColors.orange; return MyColors.orange;
} else if (code == "APPROVED") { } else if (code == "APPROVED" || code == "APPROVE") {
return const Color(0xff1FA269); return const Color(0xff1FA269);
} else if (code != "SUBMIT" && code != "REJECT" && code != "PENDING") { } else if (code != "SUBMIT" && code != "REJECT" && code != "PENDING") {
return const Color(0xff1FA269); return MyColors.orange;
} else if (code == "REQUEST_INFO") { } else if (code == "REQUEST_INFO") {
return const Color(0xff2E303A); return const Color(0xff2E303A);
} else { } else {

@ -1,5 +1,6 @@
import 'package:easy_localization/src/public_ext.dart'; import 'package:easy_localization/src/public_ext.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:mohem_flutter_app/classes/colors.dart';
import 'package:mohem_flutter_app/classes/date_uitl.dart'; import 'package:mohem_flutter_app/classes/date_uitl.dart';
import 'package:mohem_flutter_app/extensions/int_extensions.dart'; import 'package:mohem_flutter_app/extensions/int_extensions.dart';
import 'package:mohem_flutter_app/extensions/string_extensions.dart'; import 'package:mohem_flutter_app/extensions/string_extensions.dart';
@ -8,6 +9,7 @@ import 'package:mohem_flutter_app/generated/locale_keys.g.dart';
import 'package:mohem_flutter_app/models/get_absence_collection_notification_body_list_model.dart'; import 'package:mohem_flutter_app/models/get_absence_collection_notification_body_list_model.dart';
import 'package:mohem_flutter_app/models/get_item_creation_ntf_body_list_model.dart'; import 'package:mohem_flutter_app/models/get_item_creation_ntf_body_list_model.dart';
import 'package:mohem_flutter_app/models/get_po_notification_body_list_model.dart'; import 'package:mohem_flutter_app/models/get_po_notification_body_list_model.dart';
import 'package:mohem_flutter_app/models/get_pr_notification_body_list_model.dart';
import 'package:mohem_flutter_app/models/get_stamp_ms_notification_body_list_model.dart'; import 'package:mohem_flutter_app/models/get_stamp_ms_notification_body_list_model.dart';
import 'package:mohem_flutter_app/models/get_stamp_ns_notification_body_list_model.dart'; import 'package:mohem_flutter_app/models/get_stamp_ns_notification_body_list_model.dart';
import 'package:mohem_flutter_app/models/worklist/hr/eit_otification_body_model.dart'; import 'package:mohem_flutter_app/models/worklist/hr/eit_otification_body_model.dart';
@ -28,9 +30,10 @@ class InfoFragment extends StatelessWidget {
List<GetBasicDetNtfBodyList>? getBasicDetNtfBodyList; List<GetBasicDetNtfBodyList>? getBasicDetNtfBodyList;
List<GetAbsenceCollectionNotificationBodyList>? getAbsenceCollectionNotificationBodyList; List<GetAbsenceCollectionNotificationBodyList>? getAbsenceCollectionNotificationBodyList;
GetContactNotificationBodyList? getContactNotificationBodyList; GetContactNotificationBodyList? getContactNotificationBodyList;
GetPrNotificationBodyList? getPrNotificationBodyList;
InfoFragment({ InfoFragment(
this.workListData, {this.workListData,
this.poHeaderList = const <POHeader>[], this.poHeaderList = const <POHeader>[],
this.itemCreationHeader = const <ItemCreationHeader>[], this.itemCreationHeader = const <ItemCreationHeader>[],
this.getStampMsNotifications, this.getStampMsNotifications,
@ -40,7 +43,7 @@ class InfoFragment extends StatelessWidget {
this.getBasicDetNtfBodyList, this.getBasicDetNtfBodyList,
this.getAbsenceCollectionNotificationBodyList, this.getAbsenceCollectionNotificationBodyList,
this.getContactNotificationBodyList, this.getContactNotificationBodyList,
}); this.getPrNotificationBodyList});
double itemHeight = 0; double itemHeight = 0;
double itemWidth = 0; double itemWidth = 0;
@ -76,8 +79,9 @@ class InfoFragment extends StatelessWidget {
), ),
], ],
).objectContainerView(), ).objectContainerView(),
if (getStampMsNotifications?.isNotEmpty ?? false) getStampMsNotificationsListView(getStampMsNotifications ?? []).objectContainerView(title: "Stamp Notifications"), if (getPrNotificationBodyList != null) getPRNotificationBodyListWidget(getPrNotificationBodyList!),
if (getStampNsNotifications?.isNotEmpty ?? false) getStampNsNotificationsListView(getStampNsNotifications ?? []).objectContainerView(title: "Stamp Notifications"), if (getStampMsNotifications?.isNotEmpty ?? false) getStampMsNotificationsListView(getStampMsNotifications ?? []),
if (getStampNsNotifications?.isNotEmpty ?? false) getStampNsNotificationsListView(getStampNsNotifications ?? []),
if (poHeaderList.isNotEmpty) getPoNotificationsListView(), if (poHeaderList.isNotEmpty) getPoNotificationsListView(),
if (itemCreationHeader.isNotEmpty) getItemCreationHeaderView(), if (itemCreationHeader.isNotEmpty) getItemCreationHeaderView(),
if (getEitCollectionNotificationBodyList?.isNotEmpty ?? false) getEitNotificationsListView(getEitCollectionNotificationBodyList ?? []), if (getEitCollectionNotificationBodyList?.isNotEmpty ?? false) getEitNotificationsListView(getEitCollectionNotificationBodyList ?? []),
@ -218,8 +222,8 @@ class InfoFragment extends StatelessWidget {
isItLast: true, isItLast: true,
), ),
], ],
), ).objectContainerView(),
separatorBuilder: (cxt, index) => 1.divider.paddingOnly(top: 8, bottom: 8), separatorBuilder: (cxt, index) => 1.height.paddingOnly(top: 8, bottom: 8),
itemCount: list.length); itemCount: list.length);
} }
@ -240,8 +244,8 @@ class InfoFragment extends StatelessWidget {
isItLast: true, isItLast: true,
), ),
], ],
), ).objectContainerView(),
separatorBuilder: (cxt, index) => 1.divider.paddingOnly(top: 8, bottom: 8), separatorBuilder: (cxt, index) => 1.height.paddingOnly(top: 8, bottom: 8),
itemCount: list.length); itemCount: list.length);
} }
@ -433,6 +437,40 @@ class InfoFragment extends StatelessWidget {
); );
} }
Widget getPRNotificationBodyListWidget(GetPrNotificationBodyList getPrNotificationBodyList) {
return Column(
children: [
getPrNotificationBodyList.pINFORMATION.toString().toText14(color: MyColors.textMixColor).objectContainerView(),
12.height,
Column(
children: [
ItemDetailGrid(
ItemDetailViewCol(LocaleKeys.from.tr(), workListData!.fROMUSER ?? ""),
ItemDetailViewCol(LocaleKeys.to.tr(), workListData!.tOUSER ?? ""),
),
ItemDetailGrid(
ItemDetailViewCol(LocaleKeys.sent.tr(), workListData!.bEGINDATE ?? ""),
ItemDetailViewCol(LocaleKeys.closed.tr(), workListData!.eNDDATE ?? ""),
),
ItemDetailGrid(
ItemDetailViewCol(LocaleKeys.id.tr(), workListData!.nOTIFICATIONID?.toString() ?? ""),
ItemDetailViewCol(LocaleKeys.responder.tr(), workListData!.rESPONDER ?? ""),
),
ItemDetailGrid(
ItemDetailViewCol(getPrNotificationBodyList.pRHeader![2].hDRATTRIBUTENAME!, getPrNotificationBodyList.pRHeader![2].hDRATTRIBUTEVALUE ?? ""),
ItemDetailViewCol(getPrNotificationBodyList.pRHeader![0].hDRATTRIBUTENAME!, getPrNotificationBodyList.pRHeader![0].hDRATTRIBUTEVALUE ?? ""),
),
ItemDetailGrid(
ItemDetailViewCol(getPrNotificationBodyList.pRHeader![1].hDRATTRIBUTENAME!, getPrNotificationBodyList.pRHeader![1].hDRATTRIBUTEVALUE ?? ""),
Container(),
isItLast: true,
),
],
).objectContainerView(),
],
);
}
Widget getContactNotificationBodyListWidget(GetContactNotificationBodyList data) { Widget getContactNotificationBodyListWidget(GetContactNotificationBodyList data) {
bool isOdd = false; bool isOdd = false;
try { try {

@ -1,12 +1,16 @@
import 'package:easy_localization/src/public_ext.dart'; import 'package:easy_localization/src/public_ext.dart';
import 'package:expandable/expandable.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:mohem_flutter_app/classes/colors.dart';
import 'package:mohem_flutter_app/config/routes.dart'; import 'package:mohem_flutter_app/config/routes.dart';
import 'package:mohem_flutter_app/extensions/int_extensions.dart'; import 'package:mohem_flutter_app/extensions/int_extensions.dart';
import 'package:mohem_flutter_app/extensions/string_extensions.dart';
import 'package:mohem_flutter_app/extensions/widget_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/generated/locale_keys.g.dart';
import 'package:mohem_flutter_app/models/get_item_creation_ntf_body_list_model.dart'; import 'package:mohem_flutter_app/models/get_item_creation_ntf_body_list_model.dart';
import 'package:mohem_flutter_app/models/get_mo_notification_body_list_model.dart'; import 'package:mohem_flutter_app/models/get_mo_notification_body_list_model.dart';
import 'package:mohem_flutter_app/models/get_po_notification_body_list_model.dart'; import 'package:mohem_flutter_app/models/get_po_notification_body_list_model.dart';
import 'package:mohem_flutter_app/models/get_pr_notification_body_list_model.dart';
import 'package:mohem_flutter_app/ui/work_list/item_history_screen.dart'; import 'package:mohem_flutter_app/ui/work_list/item_history_screen.dart';
import 'package:mohem_flutter_app/widgets/button/default_button.dart'; import 'package:mohem_flutter_app/widgets/button/default_button.dart';
import 'package:mohem_flutter_app/widgets/item_detail_view_widget.dart'; import 'package:mohem_flutter_app/widgets/item_detail_view_widget.dart';
@ -15,12 +19,14 @@ class RequestFragment extends StatelessWidget {
final List<GetMoNotificationBodyList> moNotificationBodyList; final List<GetMoNotificationBodyList> moNotificationBodyList;
final List<ItemCreationLines> itemCreationLines; final List<ItemCreationLines> itemCreationLines;
final List<POLines> poLinesList; final List<POLines> poLinesList;
final List<PRLines> prLinesList;
RequestFragment({ RequestFragment({
Key? key, Key? key,
this.moNotificationBodyList = const <GetMoNotificationBodyList>[], this.moNotificationBodyList = const <GetMoNotificationBodyList>[],
this.itemCreationLines = const <ItemCreationLines>[], this.itemCreationLines = const <ItemCreationLines>[],
this.poLinesList = const <POLines>[], this.poLinesList = const <POLines>[],
this.prLinesList = const <PRLines>[],
}) : super(key: key); }) : super(key: key);
@override @override
@ -33,16 +39,20 @@ class RequestFragment extends StatelessWidget {
if (moNotificationBodyList.isNotEmpty) moNotificationDataView(), if (moNotificationBodyList.isNotEmpty) moNotificationDataView(),
if (poLinesList.isNotEmpty) poLinesDataView(), if (poLinesList.isNotEmpty) poLinesDataView(),
if (itemCreationLines.isNotEmpty) itemCreationLinesView(), if (itemCreationLines.isNotEmpty) itemCreationLinesView(),
if (prLinesList.isNotEmpty) prLinesDataView(),
], ],
), ),
); );
} }
Widget poLinesDataView() { Widget poLinesDataView() {
return ListView.separated( return ExpandableNotifier(
child: ListView.separated(
shrinkWrap: true, shrinkWrap: true,
physics: const NeverScrollableScrollPhysics(), physics: const NeverScrollableScrollPhysics(),
itemBuilder: (cxt, index) => Column( itemBuilder: (cxt, index) => ExpandablePanel(
header: poLinesList[index].iTEMDESCRIPTION!.toText14(),
collapsed: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: [ children: [
@ -96,9 +106,47 @@ class RequestFragment extends StatelessWidget {
], ],
) )
], ],
).objectContainerView(title: poLinesList[index].iTEMDESCRIPTION!), ),
expanded: const SizedBox(),
).objectContainerView(),
separatorBuilder: (cxt, index) => 12.height, separatorBuilder: (cxt, index) => 12.height,
itemCount: poLinesList.length); itemCount: poLinesList.length),
);
}
Widget prLinesDataView() {
return Column(
children: [
prLinesList[0].dESCRIPTION.toString().toText14(color: MyColors.textMixColor).objectContainerView(),
12.height,
Column(
children: [
ItemDetailGrid(
ItemDetailViewCol("Cost Center", prLinesList[0].cOSTCENTER ?? ""),
ItemDetailViewCol("Code", prLinesList[0].iTEMCODE ?? ""),
),
ItemDetailGrid(
ItemDetailViewCol("Unit", prLinesList[0].uOM ?? ""),
ItemDetailViewCol("Price (SAR)", prLinesList[0].uNITPRICE.toString() ?? ""),
),
ItemDetailGrid(
ItemDetailViewCol("Amount (SAR)", prLinesList[0].lINEAMOUNT.toString() ?? ""),
ItemDetailViewCol("Quantity", prLinesList[0].qUANTITY.toString() ?? ""),
),
ItemDetailGrid(
ItemDetailViewCol("AMU (Last 3 months)", prLinesList[0].iTEMAMU.toString() ?? ""),
Container(),
isItLast: true,
),
// ItemDetailGrid(
// ItemDetailViewCol(getPrNotificationBodyList.pRHeader![1].hDRATTRIBUTENAME!, getPrNotificationBodyList.pRHeader![1].hDRATTRIBUTEVALUE ?? ""),
// Container(),
// isItLast: true,
// ),
],
).objectContainerView(),
],
);
} }
Widget moNotificationDataView() { Widget moNotificationDataView() {

@ -8,8 +8,9 @@ class AttachmentOptions extends StatelessWidget {
VoidCallback onCameraTap; VoidCallback onCameraTap;
VoidCallback onGalleryTap; VoidCallback onGalleryTap;
VoidCallback onFilesTap; VoidCallback onFilesTap;
bool showFilesOption;
AttachmentOptions({Key? key, required this.onCameraTap, required this.onGalleryTap, required this.onFilesTap}) : super(key: key); AttachmentOptions({Key? key, required this.onCameraTap, required this.onGalleryTap, required this.onFilesTap, this.showFilesOption = true}) : super(key: key);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -28,7 +29,7 @@ class AttachmentOptions extends StatelessWidget {
children: [ children: [
itemView("open_camera.svg", "Open\nCamera", onCameraTap), itemView("open_camera.svg", "Open\nCamera", onCameraTap),
itemView("gallery.svg", "Upload from\nGallery", onGalleryTap), itemView("gallery.svg", "Upload from\nGallery", onGalleryTap),
itemView("files.svg", "Upload from\nFiles", onFilesTap), if (showFilesOption) itemView("files.svg", "Upload from\nFiles", onFilesTap),
], ],
) )
], ],

@ -1,14 +1,21 @@
import 'dart:convert';
import 'package:easy_localization/easy_localization.dart'; import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:mohem_flutter_app/api/chat/chat_provider_model.dart';
import 'package:mohem_flutter_app/api/worklist/worklist_api_client.dart'; import 'package:mohem_flutter_app/api/worklist/worklist_api_client.dart';
import 'package:mohem_flutter_app/app_state/app_state.dart';
import 'package:mohem_flutter_app/classes/colors.dart'; import 'package:mohem_flutter_app/classes/colors.dart';
import 'package:mohem_flutter_app/classes/utils.dart'; import 'package:mohem_flutter_app/classes/utils.dart';
import 'package:mohem_flutter_app/config/routes.dart';
import 'package:mohem_flutter_app/extensions/int_extensions.dart'; import 'package:mohem_flutter_app/extensions/int_extensions.dart';
import 'package:mohem_flutter_app/extensions/string_extensions.dart'; import 'package:mohem_flutter_app/extensions/string_extensions.dart';
import 'package:mohem_flutter_app/extensions/widget_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/generated/locale_keys.g.dart';
import 'package:mohem_flutter_app/models/chat/get_search_user_chat_model.dart';
import 'package:mohem_flutter_app/models/get_action_history_list_model.dart'; import 'package:mohem_flutter_app/models/get_action_history_list_model.dart';
import 'package:mohem_flutter_app/models/worklist/get_favorite_replacements_model.dart'; import 'package:mohem_flutter_app/models/worklist/get_favorite_replacements_model.dart';
import 'package:mohem_flutter_app/models/worklist/replacement_list_model.dart'; import 'package:mohem_flutter_app/models/worklist/replacement_list_model.dart';
@ -21,17 +28,19 @@ class SearchEmployeeBottomSheet extends StatefulWidget {
String title, apiMode; String title, apiMode;
List<GetActionHistoryList>? actionHistoryList; List<GetActionHistoryList>? actionHistoryList;
Function(ReplacementList) onSelectEmployee; Function(ReplacementList) onSelectEmployee;
bool fromChat;
SearchEmployeeBottomSheet( SearchEmployeeBottomSheet({
{required this.title, required this.title,
required this.apiMode, required this.apiMode,
this.notificationID, this.notificationID,
this.actionHistoryList, this.actionHistoryList,
required this.onSelectEmployee}); required this.onSelectEmployee,
required this.fromChat,
});
@override @override
State<SearchEmployeeBottomSheet> createState() => State<SearchEmployeeBottomSheet> createState() => _SearchEmployeeBottomSheetState();
_SearchEmployeeBottomSheetState();
} }
class _SearchEmployeeBottomSheetState extends State<SearchEmployeeBottomSheet> { class _SearchEmployeeBottomSheetState extends State<SearchEmployeeBottomSheet> {
@ -49,6 +58,9 @@ class _SearchEmployeeBottomSheetState extends State<SearchEmployeeBottomSheet> {
List<ReplacementList>? favouriteUserList; List<ReplacementList>? favouriteUserList;
List<ReplacementList>? nonFavouriteUserList; List<ReplacementList>? nonFavouriteUserList;
// Chat Items
List<ChatUser>? chatUsersList = [];
int _selectedSearchIndex = 0; int _selectedSearchIndex = 0;
void fetchUserByInput({bool isNeedLoading = true}) async { void fetchUserByInput({bool isNeedLoading = true}) async {
@ -59,12 +71,24 @@ class _SearchEmployeeBottomSheetState extends State<SearchEmployeeBottomSheet> {
userId: _selectedSearchIndex == 1 ? searchText : "", userId: _selectedSearchIndex == 1 ? searchText : "",
email: _selectedSearchIndex == 2 ? searchText : "", email: _selectedSearchIndex == 2 ? searchText : "",
); );
favouriteUserList = replacementList favouriteUserList = replacementList?.where((element) => element.isFavorite ?? false).toList();
?.where((element) => element.isFavorite ?? false) nonFavouriteUserList = replacementList?.where((element) => !(element.isFavorite ?? false)).toList();
.toList(); Utils.hideLoading(context);
nonFavouriteUserList = replacementList setState(() {});
?.where((element) => !(element.isFavorite ?? false)) } catch (e) {
.toList(); Utils.hideLoading(context);
Utils.handleException(e, context, null);
}
if (isNeedLoading) Utils.hideLoading(context);
setState(() {});
return null;
}
void fetchChatUser({bool isNeedLoading = true}) async {
try {
Utils.showLoading(context);
chatUsersList = await ChatProviderModel().getChatMemberFromSearch(searchText, int.parse(AppState().chatDetails!.response!.id.toString()));
Utils.hideLoading(context); Utils.hideLoading(context);
setState(() {}); setState(() {});
} catch (e) { } catch (e) {
@ -114,9 +138,8 @@ class _SearchEmployeeBottomSheetState extends State<SearchEmployeeBottomSheet> {
IconButton( IconButton(
constraints: const BoxConstraints(), constraints: const BoxConstraints(),
onPressed: () async { onPressed: () async {
await SystemChannels.textInput await SystemChannels.textInput.invokeMethod('TextInput.hide');
.invokeMethod('TextInput.hide'); widget.fromChat ? fetchChatUser() : fetchUserByInput();
fetchUserByInput();
}, },
icon: Icon(Icons.search)) icon: Icon(Icons.search))
], ],
@ -134,8 +157,7 @@ class _SearchEmployeeBottomSheetState extends State<SearchEmployeeBottomSheet> {
ListView.separated( ListView.separated(
physics: const NeverScrollableScrollPhysics(), physics: const NeverScrollableScrollPhysics(),
shrinkWrap: true, shrinkWrap: true,
itemBuilder: (cxt, index) => itemBuilder: (cxt, index) => employeeItemView(favouriteUserList![index]),
employeeItemView(favouriteUserList![index]),
separatorBuilder: (cxt, index) => Container( separatorBuilder: (cxt, index) => Container(
height: 1, height: 1,
color: MyColors.borderE3Color, color: MyColors.borderE3Color,
@ -149,8 +171,7 @@ class _SearchEmployeeBottomSheetState extends State<SearchEmployeeBottomSheet> {
ListView.separated( ListView.separated(
physics: const NeverScrollableScrollPhysics(), physics: const NeverScrollableScrollPhysics(),
shrinkWrap: true, shrinkWrap: true,
itemBuilder: (cxt, index) => employeeItemView( itemBuilder: (cxt, index) => employeeItemView(nonFavouriteUserList![index]),
nonFavouriteUserList![index]),
separatorBuilder: (cxt, index) => Container( separatorBuilder: (cxt, index) => Container(
height: 1, height: 1,
color: MyColors.borderE3Color, color: MyColors.borderE3Color,
@ -158,13 +179,68 @@ class _SearchEmployeeBottomSheetState extends State<SearchEmployeeBottomSheet> {
itemCount: nonFavouriteUserList?.length ?? 0), itemCount: nonFavouriteUserList?.length ?? 0),
] ]
], ],
).expanded ).expanded,
if (widget.fromChat)
if (chatUsersList != null && widget.fromChat)
chatUsersList!.isEmpty
? Utils.getNoDataWidget(context)
: ListView(
physics: const BouncingScrollPhysics(),
padding: EdgeInsets.only(top: 0, bottom: 8),
children: [
ListView.separated(
physics: const NeverScrollableScrollPhysics(),
shrinkWrap: true,
itemBuilder: (cxt, index) {
return ListTile(
leading: Stack(
children: [
SvgPicture.asset(
"assets/images/user.svg",
height: 48,
width: 48,
),
Positioned(
right: 5,
bottom: 1,
child: Container(
width: 10,
height: 10,
decoration: BoxDecoration(
color: chatUsersList![index].userStatus == 1 ? MyColors.green2DColor : Colors.red,
borderRadius: const BorderRadius.all(
Radius.circular(10),
),
),
),
)
],
),
title: (chatUsersList![index].userName ?? "").toText14(color: MyColors.darkTextColor),
subtitle: (chatUsersList![index].isTyping == true ? "Something is Typing" : "Last message text").toText11(color: MyColors.normalTextColor),
trailing: ("Today").toText10(color: MyColors.lightTextColor),
minVerticalPadding: 0,
onTap: () {
Navigator.pop(context);
Navigator.pushNamed(
context,
AppRoutes.chatDetailed,
arguments: {"targetUser": chatUsersList![index]},
);
},
);
},
separatorBuilder: (cxt, index) => Container(
height: 1,
color: MyColors.borderE3Color,
),
itemCount: chatUsersList?.length ?? 0),
12.height,
],
).expanded,
], ],
).paddingOnly(left: 21, right: 21, bottom: 0, top: 21).expanded, ).paddingOnly(left: 21, right: 21, bottom: 0, top: 21).expanded,
Container( Container(width: double.infinity, height: 1, color: MyColors.lightGreyEFColor),
width: double.infinity,
height: 1,
color: MyColors.lightGreyEFColor),
DefaultButton( DefaultButton(
LocaleKeys.cancel.tr(), LocaleKeys.cancel.tr(),
() { () {
@ -201,11 +277,7 @@ class _SearchEmployeeBottomSheetState extends State<SearchEmployeeBottomSheet> {
Expanded( Expanded(
child: (replacement.employeeDisplayName ?? "").toText12(), child: (replacement.employeeDisplayName ?? "").toText12(),
), ),
Icon(Icons.star, Icon(Icons.star, size: 16, color: replacement.isFavorite! ? MyColors.yellowFavColor : MyColors.borderCEColor),
size: 16,
color: replacement.isFavorite!
? MyColors.yellowFavColor
: MyColors.borderCEColor),
], ],
), ),
), ),
@ -228,9 +300,7 @@ class _SearchEmployeeBottomSheetState extends State<SearchEmployeeBottomSheet> {
width: double.infinity, width: double.infinity,
height: double.infinity, height: double.infinity,
decoration: BoxDecoration( decoration: BoxDecoration(
color: value == groupValue color: value == groupValue ? MyColors.grey3AColor : Colors.transparent,
? MyColors.grey3AColor
: Colors.transparent,
borderRadius: BorderRadius.all(const Radius.circular(100)), borderRadius: BorderRadius.all(const Radius.circular(100)),
), ),
), ),

@ -0,0 +1,242 @@
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
import 'package:mohem_flutter_app/classes/colors.dart';
import 'package:mohem_flutter_app/classes/date_uitl.dart';
import 'package:mohem_flutter_app/classes/utils.dart';
import 'package:mohem_flutter_app/extensions/int_extensions.dart';
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/widgets/button/default_button.dart';
import 'package:mohem_flutter_app/widgets/dynamic_forms/dynamic_textfield_widget.dart';
class WorkListAdvanceSearch extends StatefulWidget {
Function(int, String, String, String) onSearch;
WorkListAdvanceSearch(this.onSearch, {Key? key}) : super(key: key);
@override
_WorkListAdvanceSearchState createState() {
return _WorkListAdvanceSearchState();
}
}
class _WorkListAdvanceSearchState extends State<WorkListAdvanceSearch> {
final Map<int, String> advancedSearchViews = {};
final Map<int, String> advancedSearchSearchBy = {};
final Map<String, String> advancedSearchItemType = {};
int selectedViewID = 1;
String? selectedViewName;
int selectedSearchByID = 0;
String? selectedSearchByName;
String selectedItemTypeID = "";
String? selectedItemTypeName;
String searchByInput = "";
String searchByDate = "";
DateTime selectedDate = DateTime.now();
@override
void initState() {
super.initState();
advancedSearchViews.addAll({1: LocaleKeys.openNot.tr(), 2: LocaleKeys.fyi.tr(), 3: LocaleKeys.toDo.tr(), 4: LocaleKeys.all.tr(), 5: LocaleKeys.meNot.tr()});
}
@override
void dispose() {
super.dispose();
}
@override
Widget build(BuildContext context) {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
LocaleKeys.advancedSearch.tr().toText18(),
IconButton(
icon: const Icon(Icons.close, color: MyColors.darkIconColor),
onPressed: () => Navigator.pop(context),
),
],
),
12.height,
PopupMenuButton(
child: DynamicTextFieldWidget(
LocaleKeys.view.tr(),
selectedViewName != null ? selectedViewName! : LocaleKeys.selectTypeT.tr(),
isEnable: false,
isPopup: true,
isInputTypeNum: true,
isReadOnly: false,
),
itemBuilder: (_) => <PopupMenuItem<int>>[
PopupMenuItem<int>(value: 1, child: Text(LocaleKeys.openNot.tr())),
PopupMenuItem<int>(value: 2, child: Text(LocaleKeys.fyi.tr())),
PopupMenuItem<int>(value: 3, child: Text(LocaleKeys.toDo.tr())),
PopupMenuItem<int>(value: 4, child: Text(LocaleKeys.all.tr())),
PopupMenuItem<int>(value: 5, child: Text(LocaleKeys.meNot.tr())),
],
onSelected: (int popupIndex) {
selectedViewID = popupIndex;
selectedViewName = getSelectedViewName(popupIndex);
setState(() {});
},
),
12.height,
PopupMenuButton(
child: DynamicTextFieldWidget(
LocaleKeys.searchBy.tr(),
selectedSearchByName != null ? selectedSearchByName! : LocaleKeys.selectTypeT.tr(),
isEnable: false,
isPopup: true,
isInputTypeNum: true,
isReadOnly: false,
),
itemBuilder: (_) => <PopupMenuItem<int>>[
PopupMenuItem<int>(value: 1, child: Text(LocaleKeys.fromUserName.tr())),
PopupMenuItem<int>(value: 2, child: Text(LocaleKeys.subject.tr())),
PopupMenuItem<int>(value: 3, child: Text(LocaleKeys.sentDate.tr())),
PopupMenuItem<int>(value: 4, child: Text(LocaleKeys.itemTypeDisplayName.tr())),
PopupMenuItem<int>(value: 5, child: Text(LocaleKeys.none.tr())),
],
onSelected: (int popupIndex) {
selectedSearchByID = popupIndex;
selectedSearchByName = getSelectedSearchByName(popupIndex);
setState(() {});
},
),
12.height,
if (selectedSearchByID == 1 || selectedSearchByID == 2 || selectedSearchByID == 4)
DynamicTextFieldWidget(
LocaleKeys.searchBy.tr(),
LocaleKeys.searchBy.tr(),
isEnable: true,
isPopup: false,
lines: 1,
isInputTypeNum: false,
isReadOnly: false,
onChange: (String value) {
searchByInput = value;
},
),
if (selectedSearchByID == 3)
DynamicTextFieldWidget(
LocaleKeys.searchBy.tr(),
searchByDate.isEmpty ? LocaleKeys.sentDate.tr() : searchByDate,
suffixIconData: Icons.calendar_today,
isEnable: false,
onTap: () async {
selectedDate = await Utils.selectDate(context, DateTime.now());
searchByDate = selectedDate.day.toString() + "-" + DateUtil.getMonth(selectedDate.month) + "-" + selectedDate.year.toString();
setState(() {});
},
),
12.height,
PopupMenuButton(
child: DynamicTextFieldWidget(
LocaleKeys.itemType.tr(),
selectedItemTypeName != null ? selectedItemTypeName! : LocaleKeys.selectTypeT.tr(),
isEnable: false,
isPopup: true,
isInputTypeNum: true,
isReadOnly: false,
),
itemBuilder: (_) => <PopupMenuItem<String>>[
const PopupMenuItem<String>(value: "HRSSA", child: Text("HR")),
const PopupMenuItem<String>(value: "POAPPRV", child: Text("PO")),
const PopupMenuItem<String>(value: "REQAPPRV", child: Text("PR")),
const PopupMenuItem<String>(value: "INVMOA", child: Text("MR")),
const PopupMenuItem<String>(value: "INVITEM", child: Text("IC")),
const PopupMenuItem<String>(value: "STAMP", child: Text("STAMP")),
],
onSelected: (String popupIndex) {
selectedItemTypeID = popupIndex;
selectedItemTypeName = getSelectedItemType(popupIndex);
setState(() {});
},
),
20.height,
DefaultButton(LocaleKeys.search.tr(), () async {
Navigator.pop(context);
widget.onSearch(selectedViewID, selectedItemTypeID, searchByInput, searchByDate);
})
],
).paddingOnly(left: 21, right: 21, bottom: 21);
}
String getSelectedViewName(int index) {
String returnVal = "";
switch (index) {
case 1:
returnVal = LocaleKeys.openNot.tr();
break;
case 2:
returnVal = LocaleKeys.fyi.tr();
break;
case 3:
returnVal = LocaleKeys.toDo.tr();
break;
case 4:
returnVal = LocaleKeys.all.tr();
break;
case 5:
returnVal = LocaleKeys.meNot.tr();
break;
}
return returnVal;
}
String getSelectedSearchByName(int index) {
String returnVal = "";
switch (index) {
case 1:
returnVal = LocaleKeys.fromUserName.tr();
break;
case 2:
returnVal = LocaleKeys.subject.tr();
break;
case 3:
returnVal = LocaleKeys.sentDate.tr();
break;
case 4:
returnVal = LocaleKeys.itemType.tr();
break;
case 5:
returnVal = LocaleKeys.none.tr();
break;
}
return returnVal;
}
String getSelectedItemType(String index) {
String returnVal = "";
switch (index) {
case "HRSSA":
returnVal = "HR";
break;
case "POAPPRV":
returnVal = "PO";
break;
case "REQAPPRV":
returnVal = "PR";
break;
case "INVMOA":
returnVal = "MR";
break;
case "INVITEM":
returnVal = "IC";
break;
case "STAMP":
returnVal = "STAMP";
break;
}
return returnVal;
}
}

@ -15,8 +15,9 @@ class AcceptRejectInputDialog extends StatelessWidget {
final String? okTitle; final String? okTitle;
final NotificationGetRespondAttributesList? notificationGetRespond; final NotificationGetRespondAttributesList? notificationGetRespond;
final Function(String) onTap; final Function(String) onTap;
final TextEditingController textEditingController;
AcceptRejectInputDialog({Key? key, this.title, @required this.message, this.okTitle, required this.onTap, this.notificationGetRespond}) : super(key: key); AcceptRejectInputDialog({Key? key, this.title, @required this.message, this.okTitle, required this.onTap, this.notificationGetRespond, required this.textEditingController}) : super(key: key);
String note = ""; String note = "";

@ -10,10 +10,11 @@ import 'package:mohem_flutter_app/widgets/bottom_sheet.dart';
import 'package:mohem_flutter_app/widgets/bottom_sheets/attachment_options.dart'; import 'package:mohem_flutter_app/widgets/bottom_sheets/attachment_options.dart';
class ImageOptions { class ImageOptions {
static void showImageOptionsNew(BuildContext context, Function(String, File) image) { static void showImageOptionsNew(BuildContext context, bool showFilesOption, Function(String, File) image) {
showMyBottomSheet( showMyBottomSheet(
context, context,
child: AttachmentOptions( child: AttachmentOptions(
showFilesOption: showFilesOption,
onCameraTap: () async { onCameraTap: () async {
if (Platform.isAndroid) { if (Platform.isAndroid) {
cameraImageAndroid(image); cameraImageAndroid(image);

@ -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),
], ],
), ),

@ -77,6 +77,7 @@ dependencies:
flutter_rating_bar: ^4.0.1 flutter_rating_bar: ^4.0.1
auto_size_text: ^3.0.0 auto_size_text: ^3.0.0
pull_to_refresh: ^2.0.0 pull_to_refresh: ^2.0.0
expandable: ^5.0.1
#Chat #Chat
signalr_netcore: ^1.3.3 signalr_netcore: ^1.3.3

Loading…
Cancel
Save