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": "بالغ",
"updateMember": "هل انت متأكد تريد تحديث بيانات هذا العضو؟",
"fieldIsEmpty": "'{data}' الحقل فارغ. الرجاء التحديد",
"pleaseEnterComments": "الرجاء إدخال التعليقات",
"skip": "يتخطى",
"typeCurrentPasswordBelow": "اكتب كلمة المرور الحاليه",
"currentPassword": "كلمة المرور الحاليه",
"profile": {
@ -456,5 +458,16 @@
"reset_locale": "Reset Language",
"chat": "دردشة",
"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",
"updateMember": "Are You Sure You Want to Update this Member?",
"fieldIsEmpty": "'{data}' Field is empty. Please select",
"pleaseEnterComments": "Please enter comments",
"skip": "skip",
"typeCurrentPasswordBelow": "Type Your Current password below",
"currentPassword": "Current password",
"profile": {
@ -456,5 +458,16 @@
"reset_locale": "Reset Language",
"chat": "Chat",
"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/foundation.dart';
import 'package:fluttertoast/fluttertoast.dart';
import 'package:http/http.dart';
import 'package:logger/logger.dart' as L;
import 'package:logging/logging.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/utils.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_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/signalr_client.dart';
import 'package:logger/logger.dart' as L;
class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
List<SingleUserChatModel> userChatHistory = [];
@ -19,21 +24,35 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
L.Logger logger = L.Logger();
TextEditingController message = TextEditingController();
ScrollController scrollController = ScrollController();
static String token =
"eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJuYW1laWQiOiI0MjA2MiIsImVtYWlsIjoiYWFtaXIubXVoYW1tYWRAY2xvdWRzb2x1dGlvbnMuY29tLnNhIiwiaHR0cDovL3NjaGVtYXMubWljcm9zb2Z0LmNvbS93cy8yMDA4LzA2L2lkZW50aXR5L2NsYWltcy91c2VyZGF0YSI6ImFhbWlyLm11aGFtbWFkIiwiaHR0cDovL3NjaGVtYXMueG1sc29hcC5vcmcvd3MvMjAwNS8wNS9pZGVudGl0eS9jbGFpbXMvbW9iaWxlcGhvbmUiOiI5NjY1MzA4OTYwMTgiLCJuYmYiOjE2NjU5MjA2NDEsImV4cCI6MTY2NjAwNzA0MSwiaWF0IjoxNjY1OTIwNjQxfQ.70tXWdpXtQ20PNBO3WF9ScWNWSyECpFfrW7_iuOmNfWmA63PCZzlTO0E6I3q3K9Kg2CWvOT9-dSDLjlRuXuC2w";
bool isLoading = true;
void getChatMemberFromSearch(String sName, int cUserId) async {
isLoading = true;
notifyListeners();
Response response = await ApiClient().getJsonForResponse("${ApiConsts.chatSearchMember}$sName/$cUserId", token: token);
Future<void> getUserAutoLoginToken() async {
String userName = AppState().memberInformationList!.eMPLOYEEEMAILADDRESS!.split("@").first.toString();
Response response =
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;
notifyListeners();
}
List<ChatUser> searchUserJsonModel(String str) => List<ChatUser>.from(json.decode(str).map((x) => ChatUser.fromJson(x)));
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);
pChatHistory = recentChat.response;
searchedChats = pChatHistory;
@ -45,24 +64,31 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
isLoading = true;
Response response = await ApiClient().getJsonForResponse(
"${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;
logger.d(jsonEncode(userChatHistory));
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));
void buildHubConnection() async {
Future<void> buildHubConnection() async {
HttpConnectionOptions httpOp = HttpConnectionOptions(skipNegotiation: false, logMessageContent: true);
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])
.configureLogging(Logger("Logs Enabled"))
.configureLogging(
Logger("Logs Enabled"),
)
.build();
hubConnection.onclose(
({Exception? error}) {
@ -84,21 +110,65 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
await hubConnection.start();
hubConnection.on("OnUpdateUserStatusAsync", changeStatus);
hubConnection.on("OnDeliveredChatUserAsync", onMsgReceived);
// hubConnection.on("OnUserTypingAsync", onUserTyping);
//hubConnection.on("OnUserTypingAsync", changeTypingStatus);
// hubConnection.on("OnUserTypingAsync", onUserTyping);
// hubConnection.on("OnUserCountAsync", userCountAsync);
// hubConnection.on("OnUpdateUserChatHistoryWindowsAsync", updateChatHistoryWindow);
// hubConnection.on("OnGetUserChatHistoryNotDeliveredAsync", chatNotDelivered);
} else {
hubConnection.on("OnUpdateUserStatusAsync", changeStatus);
hubConnection.on("OnDeliveredChatUserAsync", onMsgReceived);
// hubConnection.on("OnUserTypingAsync", onUserTyping);
//hubConnection.on("OnUserTypingAsync", changeTypingStatus);
// hubConnection.on("OnUserTypingAsync", onUserTyping);
// hubConnection.on("OnUserCountAsync", userCountAsync);
// hubConnection.on("OnUpdateUserChatHistoryWindowsAsync", updateChatHistoryWindow);
// hubConnection.on("OnGetUserChatHistoryNotDeliveredAsync", chatNotDelivered);
}
isLoading = false;
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) {
// print("================= Status Online // Offline ====================");
List items = args!.toList();
for (var user in searchedChats!) {
logger.d(items);
for (ChatUser user in searchedChats!) {
if (user.id == items.first["id"]) {
user.userStatus = items.first["userStatus"];
}
@ -111,7 +181,7 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
if (value.isEmpty || value == "") {
tmp = pChatHistory;
} else {
for (var element in pChatHistory!) {
for (ChatUser element in pChatHistory!) {
if (element.userName!.toLowerCase().contains(value.toLowerCase())) {
tmp.add(element);
}
@ -124,7 +194,7 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
Future<void> onMsgReceived(List<Object?>? parameters) async {
List<SingleUserChatModel> data = [];
for (dynamic msg in parameters!) {
data = getSingleUserChatintoModel(jsonEncode(msg));
data = getSingleUserChatModel(jsonEncode(msg));
logger.d(msg);
}
userChatHistory.add(data.first);
@ -155,7 +225,7 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
return;
}
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)]);
userChatHistory.add(
SingleUserChatModel(
@ -165,8 +235,8 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
contantNo: "8a129295-36d7-7185-5d34-cc4eec7bcba4",
conversationId: "715f8b13-96ee-cd36-cb07-5a982a219982",
createdDate: DateTime.now(),
currentUserId: 42062,
currentUserName: "aamir.muhammad",
currentUserId: AppState().chatDetails!.response!.id,
currentUserName: AppState().chatDetails!.response!.userName,
targetUserId: targetUserId,
targetUserName: targetUserName,
),
@ -182,9 +252,6 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
curve: Curves.easeOut,
duration: const Duration(milliseconds: 300),
);
// scrollController.animateTo(double.parse(userChatHistory.length.toString()), duration: Duration(milliseconds: 500), curve: Curves.fastOutSlowIn);
notifyListeners();
}

@ -57,9 +57,11 @@ class OffersAndDiscountsApiClient {
var bodyData = json.decode(body['result']['data']);
bodyData.forEach((v) {
if(bodyData != null) {
bodyData.forEach((v) {
getSaleCategoriesList.add(OffersListModel.fromJson(v));
});
}
return getSaleCategoriesList;
},
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_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_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_stamp_ms_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_phones_notification_body_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';
class WorkListApiClient {
@ -38,13 +38,18 @@ class WorkListApiClient {
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";
Map<String, dynamic> postParams = {
"P_NOTIFICATION_TYPE": "1",
"P_NOTIFICATION_TYPE": pNotificationType,
"P_PAGE_NUM": pPageNum,
"P_PAGE_LIMIT": 50,
"P_PAGE_LIMIT": 25,
"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);
return await ApiClient().postJsonForObject((json) {
@ -231,6 +236,21 @@ class WorkListApiClient {
}, 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 {
String url = "${ApiConsts.erpRest}GET_MO_ITEM_HISTORY";
Map<String, dynamic> postParams = {
@ -481,12 +501,9 @@ class WorkListApiClient {
}, url, postParams);
}
Future<List<GetUserItemTypesList>> getUserItemTypes() async {
String url = "${ApiConsts.erpRest}GET_USER_ITEM_TYPES";
Map<String, dynamic> postParams = {
};
Map<String, dynamic> postParams = {};
postParams.addAll(AppState().postParamsJson);
return await ApiClient().postJsonForObject((json) {
GenericResponseModel responseData = GenericResponseModel.fromJson(json);
@ -496,15 +513,11 @@ class WorkListApiClient {
Future<UpdateUserItemTypesList?> updateUserItemTypes(List<Map<String, dynamic>> itemList) async {
String url = "${ApiConsts.erpRest}UPDATE_USER_ITEM_TYPES";
Map<String, dynamic> postParams = {
"UpdateItemTypeList": itemList
};
Map<String, dynamic> postParams = {"UpdateItemTypeList": itemList};
postParams.addAll(AppState().postParamsJson);
return await ApiClient().postJsonForObject((json) {
GenericResponseModel responseData = GenericResponseModel.fromJson(json);
return responseData.updateUserItemTypesList;
}, url, postParams);
}
}

@ -1,6 +1,7 @@
import 'dart:io';
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/member_information_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";
int getLanguageID(context) => EasyLocalization.of(context)?.locale.languageCode == "ar" ? 1 : 2;
String? _username;
// todo ''sikander' added password for now, later will remove & improve
@ -116,4 +119,10 @@ class AppState {
int? 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),
);
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,
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(

@ -472,7 +472,18 @@ class CodegenLoader extends AssetLoader{
"reset_locale": "Reset Language",
"chat": "دردشة",
"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 = {
"mohemm": "Mohemm",
@ -932,7 +943,18 @@ static const Map<String,dynamic> en_US = {
"reset_locale": "Reset Language",
"chat": "Chat",
"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};
}

@ -420,6 +420,8 @@ abstract class LocaleKeys {
static const adult = 'adult';
static const updateMember = 'updateMember';
static const fieldIsEmpty = 'fieldIsEmpty';
static const pleaseEnterComments = 'pleaseEnterComments';
static const skip = 'skip';
static const typeCurrentPasswordBelow = 'typeCurrentPasswordBelow';
static const currentPassword = 'currentPassword';
static const profile_reset_password_label = 'profile.reset_password.label';
@ -443,5 +445,16 @@ abstract class LocaleKeys {
static const chat = 'chat';
static const mychats = 'mychats';
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_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_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_schedule_shifts_details_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<GetPoItemHistoryList>? getPoItemHistoryList;
GetPoNotificationBodyList? getPoNotificationBodyList;
List<String>? getPrNotificationBodyList;
GetPrNotificationBodyList? getPrNotificationBodyList;
List<GetQuotationAnalysisList>? getQuotationAnalysisList;
List<String>? getRFCEmployeeListList;
List<String>? getRespondAttributeValueList;
@ -966,7 +967,7 @@ class GenericResponseModel {
});
}
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) {
getQuotationAnalysisList = <GetQuotationAnalysisList>[];
json['GetQuotationAnalysisList'].forEach((v) {
@ -1575,7 +1576,10 @@ class GenericResponseModel {
if (this.getPoNotificationBodyList != null) {
data['GetPoNotificationBodyList'] = this.getPoNotificationBodyList!.toJson();
}
data['GetPrNotificationBodyList'] = this.getPrNotificationBodyList;
if (this.getPrNotificationBodyList != null) {
data['GetPrNotificationBodyList'] = this.getPrNotificationBodyList!.toJson();
}
if (this.getQuotationAnalysisList != null) {
data['GetQuotationAnalysisList'] = this.getQuotationAnalysisList!.map((v) => v.toJson()).toList();
}

@ -150,8 +150,8 @@ class POLines {
String? iTEMCODE;
String? iTEMDESCRIPTION;
int? iTEMID;
int? lINEAMOUNT;
int? lINEDISCPERCENTAGE;
num? lINEAMOUNT;
num? lINEDISCPERCENTAGE;
int? lINENUM;
String? lINETYPE;
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 {
double? versionID;
int? channel;

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

@ -4,6 +4,7 @@ import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.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/ui/chat/chat_bubble.dart';
import 'package:mohem_flutter_app/widgets/app_bar_widget.dart';
@ -20,7 +21,7 @@ class ChatDetailScreen extends StatelessWidget {
Widget build(BuildContext context) {
userDetails = ModalRoute.of(context)!.settings.arguments;
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());
return Scaffold(
backgroundColor: const Color(0xFFF8F8F8),
@ -70,7 +71,8 @@ class ChatDetailScreen extends StatelessWidget {
width: 35,
),
onPressed: () {
m.sendChatMessage(m.message.text, userDetails["targetUser"].id, userDetails["targetUser"].userName);
// m.logger.d(userDetails);
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_svg/flutter_svg.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/config/routes.dart';
import 'package:mohem_flutter_app/extensions/string_extensions.dart';
@ -30,8 +31,9 @@ class _ChatHomeScreenState extends State<ChatHomeScreen> {
void initState() {
super.initState();
data = Provider.of<ChatProviderModel>(context, listen: false);
data.buildHubConnection();
data.getUserRecentChats();
data.getUserAutoLoginToken().whenComplete(() {
data.getUserRecentChats();
});
}
@override
@ -115,7 +117,7 @@ class _ChatHomeScreenState extends State<ChatHomeScreen> {
Navigator.pushNamed(
context,
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(
title: LocaleKeys.searchForEmployee.tr(),
apiMode: LocaleKeys.delegate.tr(),
fromChat: true,
onSelectEmployee: (_selectedEmployee) {
// Navigator.pop(context);
// selectedReplacementEmployee = _selectedEmployee;

@ -32,9 +32,9 @@ class EmployeeDigitialIdDialog extends StatelessWidget {
Container(
width: 80,
height: 80,
decoration: BoxDecoration(
decoration: const BoxDecoration(
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)],
),
clipBehavior: Clip.antiAlias,
@ -44,7 +44,7 @@ class EmployeeDigitialIdDialog extends StatelessWidget {
child: SvgPicture.asset("assets/images/user.svg"),
)
: Image.memory(
Utils.getPostBytes(
Utils.dataFromBase64String(
AppState().memberInformationList!.eMPLOYEEIMAGE ?? "",
),
fit: BoxFit.cover,

@ -80,7 +80,7 @@ class _DashboardScreenState extends State<DashboardScreen> {
mainAxisSize: MainAxisSize.min,
children: [
Image.memory(
Utils.getPostBytes(
Utils.dataFromBase64String(
AppState().memberInformationList!.eMPLOYEEIMAGE ?? "",
),
errorBuilder: (BuildContext context, error, stackTrace) {
@ -162,18 +162,21 @@ class _DashboardScreenState extends State<DashboardScreen> {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
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)
Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
9.height,
CountdownTimer(
endTime: model.endTime,
onEnd: null,
endWidget: "00:00:00".toText14(color: Colors.white, isBold: true),
textStyle: TextStyle(color: Colors.white, fontSize: 14, letterSpacing: -0.48, fontWeight: FontWeight.bold),
Directionality(
textDirection: TextDirection.ltr,
child: CountdownTimer(
endTime: model.endTime,
onEnd: null,
endWidget: "00:00:00".toText14(color: Colors.white, isBold: true),
textStyle: const TextStyle(color: Colors.white, fontSize: 14, letterSpacing: -0.48, fontWeight: FontWeight.bold),
),
),
LocaleKeys.timeLeftToday.tr().toText12(color: Colors.white),
9.height,
@ -206,16 +209,18 @@ class _DashboardScreenState extends State<DashboardScreen> {
.toText14(color: Colors.white, isBold: true),
4.height,
],
).paddingOnly(left: 12),
).paddingOnly(left: 12, right: 12),
),
Container(
margin: EdgeInsets.only(top: AppState().isArabic(context) ? 6 : 0),
width: 45,
height: 45,
padding: const EdgeInsets.only(left: 14, right: 14),
decoration: const BoxDecoration(
decoration: BoxDecoration(
color: Color(0xff259EA4),
borderRadius: BorderRadius.only(
bottomRight: Radius.circular(15),
bottomRight: AppState().isArabic(context) ? Radius.circular(0) : Radius.circular(15),
bottomLeft: AppState().isArabic(context) ? Radius.circular(15) : Radius.circular(0),
),
),
child: SvgPicture.asset(model.isTimeRemainingInSeconds == 0 ? "assets/images/play.svg" : "assets/images/stop.svg"),
@ -257,7 +262,7 @@ class _DashboardScreenState extends State<DashboardScreen> {
border: Border.all(color: MyColors.lightGreyEDColor, width: 1),
),
child: Column(
mainAxisSize: MainAxisSize.min,
mainAxisSize: MainAxisSize.min,crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
crossAxisAlignment: CrossAxisAlignment.center,
@ -360,7 +365,7 @@ class _DashboardScreenState extends State<DashboardScreen> {
],
),
drawer: SafeArea(
child: AppDrawer(),
child: AppDrawer(onLanguageChange: _onRefresh),
),
bottomNavigationBar: SizedBox(
height: Platform.isAndroid ? 70 : 100,
@ -414,7 +419,7 @@ class _DashboardScreenState extends State<DashboardScreen> {
"assets/icons/item_for_sale.svg",
color: currentIndex == 3 ? MyColors.grey3AColor : MyColors.grey98Color,
).paddingAll(4),
label: LocaleKeys.chat.tr(),
label: LocaleKeys.itemsForSale.tr(),
),
BottomNavigationBarItem(
icon: SvgPicture.asset(

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

@ -76,11 +76,7 @@ class ServicesWidget extends StatelessWidget {
Expanded(
child: data.homeMenus![parentIndex].menuEntiesList[index].prompt!.toText10(isBold: true),
),
RotatedBox(
quarterTurns: AppState().isArabic(context) ? 2:4,
child: SvgPicture.asset("assets/images/arrow_next.svg").paddingOnly(bottom: 4)
),
RotatedBox(quarterTurns: AppState().isArabic(context) ? 2 : 4, child: SvgPicture.asset("assets/images/arrow_next.svg").paddingOnly(bottom: 4)),
],
)
],
@ -118,9 +114,8 @@ class ServicesWidget extends StatelessWidget {
Navigator.of(context).pushNamed(AppRoutes.profile);
return;
}
List<GetMenuEntriesList> menuList = pro.getMenuEntriesList?.where((element) => element.parentMenuName == menuEntry.menuName && element.menuEntryType == "FUNCTION").toList() ?? [];
List<GetMenuEntriesList> menuList = pro.getMenuEntriesList?.where((element) => element.parentMenuName == menuEntry.menuName && (element.menuEntryType == "FUNCTION")).toList() ?? [];
menuEntry.icon = "";
print(menuEntry.toJson());
if (menuList.isEmpty) {
if (menuEntry.requestType == "EIT") {
Navigator.pushNamed(context, AppRoutes.dynamicScreen, arguments: DynamicListViewParams(menuEntry.prompt!, menuEntry.functionName!));
@ -128,7 +123,9 @@ class ServicesWidget extends StatelessWidget {
Navigator.pushNamed(context, AppRoutes.monthlyPaySlip);
}
} else {
Navigator.pushNamed(context, AppRoutes.servicesMenuListScreen, arguments: ServicesMenuListScreenParams(menuEntry.prompt!, menuList));
List<GetMenuEntriesList> _menuList =
pro.getMenuEntriesList?.where((element) => element.parentMenuName == menuEntry.menuName && (element.menuEntryType == "FUNCTION" || element.menuEntryType == "MENU")).toList() ?? [];
Navigator.pushNamed(context, AppRoutes.servicesMenuListScreen, arguments: ServicesMenuListScreenParams(menuEntry.prompt!, _menuList.isEmpty ? menuList : _menuList));
}
return;
}

@ -109,14 +109,14 @@ class _AddLeaveBalanceScreenState extends State<AddLeaveBalanceScreen> {
}
}
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);
SumbitAbsenceTransactionList submit = await LeaveBalanceApiClient().submitAbsenceTransaction(
selectedAbsenceType!.dESCFLEXCONTEXTCODE!,
"HR_LOA_SS",
selectedAbsenceType!.aBSENCEATTENDANCETYPEID!,
selectedReplacementEmployee!.userName!,
selectedReplacementEmployee != null ? selectedReplacementEmployee!.userName! : "",
DateUtil.getFormattedDate(startDateTime!, "MM/dd/yyyy"),
DateUtil.getFormattedDate(endDateTime!, "MM/dd/yyyy"),
-999,
@ -126,9 +126,9 @@ class _AddLeaveBalanceScreenState extends State<AddLeaveBalanceScreen> {
Utils.hideLoading(context);
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!);
Utils.hideLoading(context);
// Utils.hideLoading(context);
} catch (ex) {
Utils.hideLoading(context);
Utils.handleException(ex, context, null);
@ -175,7 +175,7 @@ class _AddLeaveBalanceScreenState extends State<AddLeaveBalanceScreen> {
12.height,
DynamicTextFieldWidget(
LocaleKeys.startDateT.tr() + "*",
startDateTime == null ? "Select date" : startDateTime.toString().split(' ')[0],
startDateTime == null ? LocaleKeys.pleaseSelectDate.tr() : startDateTime.toString().split(' ')[0],
suffixIconData: Icons.calendar_today,
isEnable: false,
onTap: () async {
@ -189,7 +189,7 @@ class _AddLeaveBalanceScreenState extends State<AddLeaveBalanceScreen> {
12.height,
DynamicTextFieldWidget(
LocaleKeys.endDateT.tr() + "*",
endDateTime == null ? "Select date" : endDateTime.toString().split(' ')[0],
endDateTime == null ? LocaleKeys.pleaseSelectDate.tr() : endDateTime.toString().split(' ')[0],
suffixIconData: Icons.calendar_today,
isEnable: false,
isReadOnly: selectedAbsenceType == null || startDateTime == null,
@ -206,7 +206,7 @@ class _AddLeaveBalanceScreenState extends State<AddLeaveBalanceScreen> {
12.height,
DynamicTextFieldWidget(
LocaleKeys.totalDays.tr(),
totalDays?.toString() ?? "Calculated days",
totalDays?.toString() ?? LocaleKeys.calculatedDays.tr(),
isInputTypeNum: true,
isEnable: false,
onChange: (input) {
@ -224,6 +224,7 @@ class _AddLeaveBalanceScreenState extends State<AddLeaveBalanceScreen> {
child: SearchEmployeeBottomSheet(
title: LocaleKeys.searchForEmployee.tr(),
apiMode: LocaleKeys.delegate.tr(),
fromChat: false,
onSelectEmployee: (_selectedEmployee) {
// Navigator.pop(context);
selectedReplacementEmployee = _selectedEmployee;

@ -5,6 +5,7 @@ import 'package:easy_localization/src/public_ext.dart';
import 'package:firebase_core/firebase_core.dart';
import 'package:firebase_messaging/firebase_messaging.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:mohem_flutter_app/api/login_api_client.dart';
@ -50,7 +51,7 @@ class _LoginScreenState extends State<LoginScreen> {
@override
void initState() {
super.initState();
// checkFirebaseToken();
// checkFirebaseToken();
}
@override
@ -129,14 +130,14 @@ class _LoginScreenState extends State<LoginScreen> {
Widget build(BuildContext context) {
if (isAppOpenBySystem == null) {
isAppOpenBySystem = (ModalRoute.of(context)!.settings.arguments ?? true) as bool;
// username.text = "15153";
// password.text = "Abcd@12345";
if (kDebugMode) {
// username.text = "15444"; // Maha User
username.text = "15153"; // Tamer User
password.text = "Abcd@12345";
}
if (isAppOpenBySystem!) checkFirebaseToken();
}
// username.text = "15444";
return Scaffold(
body: Column(
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/widget_extensions.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/widgets/app_bar_widget.dart';
import 'package:provider/provider.dart';
class ServicesMenuListScreenParams {
final String title;
@ -29,10 +31,7 @@ class ServicesMenuListScreen extends StatelessWidget {
return Scaffold(
backgroundColor: Colors.white,
appBar: AppBarWidget(
context,
title: servicesMenuData.title,
),
appBar: AppBarWidget(context, title: servicesMenuData.title),
body: SizedBox(
width: 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!));
} else {
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(
height: 200,
margin: EdgeInsets.only(top: 30),
decoration: BoxDecoration(image: DecorationImage(image: MemoryImage(Utils.getPostBytes(getEmployeeSubordinates!.eMPLOYEEIMAGE)), fit: BoxFit.cover)),
decoration: BoxDecoration(image: DecorationImage(image: MemoryImage(Utils.dataFromBase64String(getEmployeeSubordinates!.eMPLOYEEIMAGE!)), fit: BoxFit.cover)),
child: new BackdropFilter(
filter: new ImageFilter.blur(sigmaX: 10.0, sigmaY: 10.0),
child: new Container(

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

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

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

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

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

@ -203,7 +203,7 @@ class _ItgDetailScreenState extends State<ItgDetailScreen> {
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.end,
children: [
myFab("Skip", "assets/images/skip.svg").onPress(() {
myFab(LocaleKeys.pleaseEnterComments.tr(), "assets/images/skip.svg").onPress(() {
if (AppState().requestAllList!.length - 1 > AppState().itgWorkListIndex!) {
AppState().itgWorkListIndex = AppState().itgWorkListIndex! + 1;
requestDetails = null;
@ -259,7 +259,8 @@ class _ItgDetailScreenState extends State<ItgDetailScreen> {
void handleFabAction(AllowedActions action) {
switch (action.action) {
case "DELEGATE":
// do something
// showMyBottomSheet(context, child: DelegateSheet(title: LocaleKeys.delegate.tr(), apiMode: action.action!, notificationID: workListData!.nOTIFICATIONID, actionHistoryList: actionHistoryList));
break;
case "REQUEST_INFO":
// do something else
@ -355,7 +356,18 @@ class _ItgDetailScreenState extends State<ItgDetailScreen> {
ITGRequest? itgRequest = await WorkListApiClient().rejectITGRequest(requestType, taskId, itemId, employeeNumber, comments);
Utils.hideLoading(context);
Utils.showToast(LocaleKeys.yourChangeHasBeenSavedSuccessfully.tr());
Navigator.pop(context, "delegate_reload");
// Navigator.pop(context, "delegate_reload");
AppState().workList!.removeAt(AppState().workListIndex!);
if (AppState().workList!.isEmpty) {
Navigator.pop(context, "delegate_reload");
} else {
if (AppState().workList!.length <= AppState().workListIndex!) {
Navigator.pop(context, "delegate_reload");
} else {
requestDetails = null;
getDataFromState();
}
}
} catch (ex) {
Utils.hideLoading(context);
Utils.handleException(ex, context, null);
@ -368,7 +380,18 @@ class _ItgDetailScreenState extends State<ItgDetailScreen> {
ITGRequest? itgRequest = await WorkListApiClient().approveITGRequest(requestType, taskId, itemId, employeeNumber, comments);
Utils.hideLoading(context);
Utils.showToast(LocaleKeys.yourChangeHasBeenSavedSuccessfully.tr());
Navigator.pop(context, "delegate_reload");
// Navigator.pop(context, "delegate_reload");
AppState().workList!.removeAt(AppState().workListIndex!);
if (AppState().workList!.isEmpty) {
Navigator.pop(context, "delegate_reload");
} else {
if (AppState().workList!.length <= AppState().workListIndex!) {
Navigator.pop(context, "delegate_reload");
} else {
requestDetails = null;
getDataFromState();
}
}
} catch (ex) {
Utils.hideLoading(context);
Utils.handleException(ex, context, null);

@ -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/models/generic_response_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/replacement_list_model.dart';
import 'package:mohem_flutter_app/ui/work_list/sheets/search_options_sheet.dart';
@ -25,8 +26,9 @@ class DelegateSheet extends StatefulWidget {
int? notificationID;
String title, apiMode;
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
State<DelegateSheet> createState() => _DelegateSheetState();
@ -204,7 +206,7 @@ class _DelegateSheetState extends State<DelegateSheet> {
onPressed: () {
fetchUserByInput();
},
child: Text(
child: const Text(
"Search",
style: TextStyle(
color: Colors.blue,

@ -83,22 +83,26 @@ class SelectedItemSheet extends StatelessWidget {
16.width,
Expanded(
child: DefaultButton(
LocaleKeys.submit.tr(),
LocaleKeys.submit.tr(),
() {
String? email = "", userId = "";
if (actionHistoryList != null) {
email = actionHistoryList!.eMAILADDRESS;
userId = actionHistoryList!.uSERNAME;
} else if (favoriteReplacements != null) {
email = favoriteReplacements!.emailAddress;
userId = favoriteReplacements!.userName;
if (comment.trim() != "") {
String? email = "", userId = "";
if (actionHistoryList != null) {
email = actionHistoryList!.eMAILADDRESS;
userId = actionHistoryList!.uSERNAME;
} else if (favoriteReplacements != null) {
email = favoriteReplacements!.emailAddress;
userId = favoriteReplacements!.userName;
} else {
email = replacementList!.emailAddress;
userId = replacementList!.userName;
}
performNetworkCall(context, email: email ?? "", userId: userId ?? "");
} else {
email = replacementList!.emailAddress;
userId = replacementList!.userName;
Utils.showToast("Please enter comments");
}
performNetworkCall(context, email: email ?? "", userId: userId ?? "");
},
colors: [
colors: const [
Color(0xff32D892),
Color(0xff1AB170),
],

@ -1,4 +1,5 @@
import 'package:easy_localization/src/public_ext.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/svg.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/provider/dashboard_provider_model.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:pull_to_refresh/pull_to_refresh.dart';
@ -87,6 +90,10 @@ class _WorkListScreenState extends State<WorkListScreen> {
final RefreshController _refreshController = RefreshController(initialRefresh: false);
final ScrollController _controller = ScrollController();
int pNotificationType = 1;
@override
void initState() {
super.initState();
@ -132,7 +139,7 @@ class _WorkListScreenState extends State<WorkListScreen> {
}
} else {
itgRequestTypeIndex = null;
workList = await WorkListApiClient().getWorkList(pageNumber, workListItemTypes[workListItemIndex].key);
workList = await WorkListApiClient().getWorkList(pageNumber, workListItemTypes[workListItemIndex].key, pNotificationType.toString());
AppState().setWorkList = workList;
}
if (showLoading) Utils.hideLoading(context);
@ -152,6 +159,7 @@ class _WorkListScreenState extends State<WorkListScreen> {
getWorkList(showLoading: false),
]);
calculateCounter();
Utils.hideLoading(context);
setState(() {});
} catch (ex) {
Utils.hideLoading(context);
@ -183,6 +191,7 @@ class _WorkListScreenState extends State<WorkListScreen> {
SizedBox(
height: 40,
child: ListView.separated(
controller: _controller,
itemBuilder: (context, index) {
return Container(
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})" : ""}")
.toText12(color: workListItemIndex == index ? MyColors.white : MyColors.black),
).onPress(() {
if (pNotificationType != 1) {
pNotificationType = 1;
}
if (workListItemIndex != index && !workListItemTypes[index].disable) {
workListItemIndex = index;
if (workListItemTypes[index].value == 0) {
@ -213,7 +225,15 @@ class _WorkListScreenState extends State<WorkListScreen> {
padding: const EdgeInsets.only(left: 21, right: 21),
),
).paddingOnly(top: 21, bottom: 21),
workListItemTypes[workListItemIndex].fullName.toSectionHeading().paddingOnly(left: 21, right: 21),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
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(
enablePullDown: true,
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) {
return InkWell(
onTap: () async {
@ -390,6 +442,8 @@ class _WorkListScreenState extends State<WorkListScreen> {
calculateCounter();
if (mounted) setState(() {});
}
} else {
if (mounted) setState(() {});
}
},
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:flutter/material.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_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_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_ns_notification_body_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? subordinatesLeavesModel;
GetPoNotificationBodyList? getPoNotificationBody;
GetPrNotificationBodyList? getPrNotificationBody;
GetItemCreationNtfBodyList? getItemCreationNtfBody;
bool isCloseAvailable = false;
@ -93,91 +93,77 @@ class _WorkListDetailScreenState extends State<WorkListDetailScreen> {
}
void getData() async {
try {
Utils.showLoading(context);
if (workListData!.iTEMTYPE == "HRSSA" || workListData!.iTEMTYPE == "STAMP") {
memberInformationListModel = await WorkListApiClient().getUserInformation(-999, workListData!.sELECTEDEMPLOYEENUMBER!);
}
if (workListData!.iTEMTYPE == "HRSSA") {
if (workListData!.rEQUESTTYPE == "EIT") {
getEitCollectionNotificationBodyList = await WorkListApiClient().GetEitNotificationBody(workListData!.nOTIFICATIONID);
} else if (workListData!.rEQUESTTYPE == "PHONE_NUMBERS") {
getPhonesNotificationBodyList = await WorkListApiClient().getPhonesNotificationBodyList(workListData!.nOTIFICATIONID);
} else if (workListData!.rEQUESTTYPE == "BASIC_DETAILS") {
getBasicDetNtfBodyList = await WorkListApiClient().getBasicDetNtfBodyList(workListData!.nOTIFICATIONID);
} else if (workListData!.rEQUESTTYPE == "ABSENCE") {
getAbsenceCollectionNotificationBodyList = await WorkListApiClient().getAbsenceNotificationBody(workListData!.nOTIFICATIONID);
} else if (workListData!.rEQUESTTYPE == "CONTACT") {
getContactNotificationBodyList = await WorkListApiClient().getContactNotificationBodyList(workListData!.nOTIFICATIONID);
}
// getBasicNTFBody = await WorkListApiClient().getBasicDetNTFBody(workListData!.nOTIFICATIONID!, -999);
// getAbsenceCollectionNotifications = await WorkListApiClient().getAbsenceNotificationBody(workListData!.nOTIFICATIONID!, -999);
// subordinatesLeavesModel = await WorkListApiClient().getSubordinatesLeaves("", "");
}
if (workListData!.iTEMTYPE == "STAMP") {
if (workListData!.rEQUESTTYPE == "STAMP_MS") {
getStampMsNotifications = await WorkListApiClient().getStampMsNotificationBody(workListData!.nOTIFICATIONID!, -999);
} else {
getStampNsNotifications = await WorkListApiClient().getStampNsNotificationBody(workListData!.nOTIFICATIONID!, -999);
}
}
if (workListData!.iTEMTYPE == "INVMOA") {
getMoNotificationBodyList = await WorkListApiClient().getMoNotificationBody(workListData!.nOTIFICATIONID!, -999);
}
if (workListData!.iTEMTYPE == "INVITEM") {
getItemCreationNtfBody = await WorkListApiClient().getItemCreationNtfBody(workListData!.nOTIFICATIONID!, -999);
}
if (workListData!.iTEMTYPE == "POAPPRV") {
getPoNotificationBody = await WorkListApiClient().getPoNotificationBody(workListData!.nOTIFICATIONID!, -999);
}
getNotificationRespondAttributes = await WorkListApiClient().notificationGetRespondAttributes(workListData!.nOTIFICATIONID!);
if (getNotificationRespondAttributes.isNotEmpty) {
notificationNoteInput = getNotificationRespondAttributes.first;
// try {
// Utils.showLoading(context);
if (workListData!.iTEMTYPE == "HRSSA" || workListData!.iTEMTYPE == "STAMP") {
getUserInformation();
}
if (workListData!.iTEMTYPE == "HRSSA") {
if (workListData!.rEQUESTTYPE == "EIT") {
getEitNotificationBody();
} else if (workListData!.rEQUESTTYPE == "PHONE_NUMBERS") {
getPhonesNotificationBody();
} else if (workListData!.rEQUESTTYPE == "BASIC_DETAILS") {
getBasicDetNtfBody();
} else if (workListData!.rEQUESTTYPE == "ABSENCE") {
getAbsenceNotificationBody();
} else if (workListData!.rEQUESTTYPE == "CONTACT") {
getContactNotificationBody();
}
// getBasicNTFBody = await WorkListApiClient().getBasicDetNTFBody(workListData!.nOTIFICATIONID!, -999);
// getAbsenceCollectionNotifications = await WorkListApiClient().getAbsenceNotificationBody(workListData!.nOTIFICATIONID!, -999);
// subordinatesLeavesModel = await WorkListApiClient().getSubordinatesLeaves("", "");
}
if (workListData!.iTEMTYPE == "STAMP") {
getStampNotificationBody();
}
if (workListData!.iTEMTYPE == "INVMOA") {
getMoNotificationBody();
}
if (workListData!.iTEMTYPE == "INVITEM") {
getItemCreationNtf();
}
if (workListData!.iTEMTYPE == "POAPPRV") {
getPoNotification();
}
if (workListData!.iTEMTYPE == "REQAPPRV") {
getPRNotification();
}
List dataToFetch = await Future.wait([
WorkListApiClient().getNotificationButtons(workListData!.nOTIFICATIONID!),
WorkListApiClient().getActionHistory(workListData!.nOTIFICATIONID!),
WorkListApiClient().getAttachments(workListData!.nOTIFICATIONID!),
]);
notificationButtonsList = dataToFetch[0];
actionHistoryList = dataToFetch[1];
getAttachmentList = dataToFetch[2];
notificationGetRespondAttributes();
// List<Future> futureRequest = [];
// List<Object> futureObject = [];
//
// addRequestInFuture(notificationButtonsList, WorkListApiClient().getNotificationButtons(workListData!.nOTIFICATIONID!));
// addRequestInFuture(actionHistoryList, WorkListApiClient().getActionHistory(workListData!.nOTIFICATIONID!));
// addRequestInFuture(getAttachmentList, WorkListApiClient().getAttachments(workListData!.nOTIFICATIONID!));
// List dataToFetch = await Future.wait([
//
// WorkListApiClient().getActionHistory(workListData!.nOTIFICATIONID!),
// WorkListApiClient().getAttachments(workListData!.nOTIFICATIONID!),
// ]);
//
// notificationButtonsList = dataToFetch[0];
// actionHistoryList = dataToFetch[1];
// getAttachmentList = dataToFetch[2];
// List dataToFetch = await Future.wait(futureRequest);
// for(int i=0;i<dataToFetch.length;i++) {
// futureObject[i] = dataToFetch[i];
// }
getNotificationButtons();
getActionHistory();
getAttachments();
if (notificationButtonsList.isNotEmpty) {
isCloseAvailable = notificationButtonsList.any((element) => element.bUTTONACTION == "CLOSE");
isApproveAvailable = notificationButtonsList.any((element) => element.bUTTONACTION == "APPROVED");
isRejectAvailable = notificationButtonsList.any((element) => element.bUTTONACTION == "REJECTED");
}
Utils.hideLoading(context);
setState(() {});
} catch (ex) {
Utils.hideLoading(context);
Utils.handleException(ex, context, null);
}
// if (notificationButtonsList.isNotEmpty) {
// isCloseAvailable = notificationButtonsList.any((element) => element.bUTTONACTION == "CLOSE");
// isApproveAvailable = notificationButtonsList.any((element) => element.bUTTONACTION == "APPROVED");
// isRejectAvailable = notificationButtonsList.any((element) => element.bUTTONACTION == "REJECTED");
// }
// Utils.hideLoading(context);
// setState(() {});
// } catch (ex) {
// Utils.hideLoading(context);
// Utils.handleException(ex, context, null);
// setState(() {});
// }
}
List<Future> futureRequest = [];
List<Object> futureObject = [];
void addRequestInFuture(data, request) {
futureObject.add(data);
futureRequest.add(request);
}
int apiCallCount = 0;
void getDataFromState() {
if (workListData == null) {
@ -243,6 +229,7 @@ class _WorkListDetailScreenState extends State<WorkListDetailScreen> {
getBasicDetNtfBodyList: getBasicDetNtfBodyList,
getAbsenceCollectionNotificationBodyList: getAbsenceCollectionNotificationBodyList,
getContactNotificationBodyList: getContactNotificationBodyList,
getPrNotificationBodyList: getPrNotificationBody,
),
(workListData!.iTEMTYPE == "HRSSA" || workListData!.iTEMTYPE == "STAMP")
? DetailFragment(workListData, memberInformationListModel)
@ -250,6 +237,7 @@ class _WorkListDetailScreenState extends State<WorkListDetailScreen> {
moNotificationBodyList: getMoNotificationBodyList,
poLinesList: getPoNotificationBody?.pOLines ?? [],
itemCreationLines: getItemCreationNtfBody?.itemCreationLines ?? [],
prLinesList: getPrNotificationBody?.pRLines ?? [],
),
actionHistoryList.isEmpty ? Utils.getNoDataWidget(context) : ActionsFragment(workListData!.nOTIFICATIONID, actionHistoryList),
getAttachmentList.isEmpty ? Utils.getNoDataWidget(context) : AttachmentsFragment(getAttachmentList),
@ -319,7 +307,7 @@ class _WorkListDetailScreenState extends State<WorkListDetailScreen> {
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.end,
children: [
myFab("Skip", "assets/images/skip.svg").onPress(() {
myFab(LocaleKeys.pleaseEnterComments.tr(), "assets/images/skip.svg").onPress(() {
if (AppState().workList!.length - 1 > AppState().workListIndex!) {
AppState().setWorkListIndex = AppState().workListIndex! + 1;
workListData = null;
@ -376,33 +364,34 @@ class _WorkListDetailScreenState extends State<WorkListDetailScreen> {
void handleFabAction(GetNotificationButtonsList notificationButton) {
switch (notificationButton.bUTTONACTION) {
case "DELEGATE":
// do something
showMyBottomSheet(context, child: DelegateSheet(title: "Delegate", apiMode: "DELEGATE", notificationID: workListData!.nOTIFICATIONID, actionHistoryList: actionHistoryList));
showMyBottomSheet(context,
child: DelegateSheet(title: LocaleKeys.delegate.tr(), apiMode: notificationButton.bUTTONACTION!, notificationID: workListData!.nOTIFICATIONID, actionHistoryList: actionHistoryList));
break;
case "REQUEST_INFO":
// 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;
case "RFC":
// do something else
break;
case "APPROVE":
performAction(notificationButton.bUTTONACTION!);
break;
case "UPDATE_ACTION":
// do something else
case "APPROVE_AND_FORWARD":
// do something else
showMyBottomSheet(context,
child: DelegateSheet(title: "Approve and Forward", apiMode: "APPROVE_AND_FORWARD", notificationID: workListData!.nOTIFICATIONID, actionHistoryList: actionHistoryList));
break;
case "FORWARD":
// do something else
showMyBottomSheet(context, child: DelegateSheet(title: "Forward", apiMode: "FORWARD", notificationID: workListData!.nOTIFICATIONID, actionHistoryList: actionHistoryList));
break;
case "REJECT":
// do something else
performNetworkCall(context, email: "", userId: "");
break;
case "RETURNED":
// do something else
Navigator.pop(context);
break;
}
@ -482,7 +471,7 @@ class _WorkListDetailScreenState extends State<WorkListDetailScreen> {
child: isIconAsset
? SvgPicture.asset(icon)
: Image.memory(
base64Decode(icon),
Utils.dataFromBase64String(icon),
fit: BoxFit.cover,
),
)
@ -491,16 +480,19 @@ class _WorkListDetailScreenState extends State<WorkListDetailScreen> {
}
void performAction(String actionMode) {
TextEditingController textEditingController = TextEditingController();
print("actionMode:$actionMode");
showDialog(
context: context,
builder: (cxt) => AcceptRejectInputDialog(
message: LocaleKeys.requestedItems.tr(),
notificationGetRespond: notificationNoteInput,
textEditingController: textEditingController,
onTap: (note) {
Map<String, dynamic> payload = {
"P_ACTION_MODE": actionMode,
"P_APPROVER_INDEX": null,
"P_COMMENTS": "",
"P_COMMENTS": note,
"P_FORWARD_TO_USER_NAME": "",
"P_NOTIFICATION_ID": workListData!.nOTIFICATIONID,
"RespondAttributeList": [
@ -511,7 +503,13 @@ class _WorkListDetailScreenState extends State<WorkListDetailScreen> {
}
],
};
performNotificationAction(payload);
if (actionMode == "APPROVED" || actionMode == "APPROVE") {
performNotificationAction(payload);
} else if (note.isNotEmpty && (actionMode != "APPROVED" || actionMode != "APPROVE")) {
performNotificationAction(payload);
} else {
Utils.showToast(LocaleKeys.pleaseEnterComments.tr());
}
},
),
);
@ -523,10 +521,287 @@ class _WorkListDetailScreenState extends State<WorkListDetailScreen> {
GenericResponseModel model = await WorkListApiClient().postNotificationActions(payload);
Utils.hideLoading(context);
Utils.showToast(LocaleKeys.yourChangeHasBeenSavedSuccessfully.tr());
Navigator.pop(context, true);
AppState().workList!.removeAt(AppState().workListIndex!);
if (AppState().workList!.isEmpty) {
Navigator.pop(context, "delegate_reload");
} else {
if (AppState().workList!.length <= AppState().workListIndex!) {
Navigator.pop(context, "delegate_reload");
} else {
workListData = null;
getDataFromState();
}
}
} catch (ex) {
Utils.hideLoading(context);
Utils.handleException(ex, context, null);
}
}
void getEitNotificationBody() async {
try {
if (apiCallCount == 0) Utils.showLoading(context);
apiCallCount++;
getEitCollectionNotificationBodyList = await WorkListApiClient().GetEitNotificationBody(workListData!.nOTIFICATIONID);
apiCallCount--;
if (apiCallCount == 0) {
Utils.hideLoading(context);
setState(() {});
}
} catch (ex) {
apiCallCount--;
Utils.hideLoading(context);
Utils.handleException(ex, context, null);
}
}
void getUserInformation() async {
try {
if (apiCallCount == 0) Utils.showLoading(context);
apiCallCount++;
memberInformationListModel = await WorkListApiClient().getUserInformation(-999, workListData!.sELECTEDEMPLOYEENUMBER!);
apiCallCount--;
if (apiCallCount == 0) {
Utils.hideLoading(context);
setState(() {});
}
} catch (ex) {
apiCallCount--;
Utils.hideLoading(context);
Utils.handleException(ex, context, null);
}
}
void getPhonesNotificationBody() async {
try {
if (apiCallCount == 0) Utils.showLoading(context);
apiCallCount++;
getPhonesNotificationBodyList = await WorkListApiClient().getPhonesNotificationBodyList(workListData!.nOTIFICATIONID);
apiCallCount--;
if (apiCallCount == 0) {
Utils.hideLoading(context);
setState(() {});
}
} catch (ex) {
apiCallCount--;
Utils.hideLoading(context);
Utils.handleException(ex, context, null);
}
}
void getBasicDetNtfBody() async {
try {
if (apiCallCount == 0) Utils.showLoading(context);
apiCallCount++;
getBasicDetNtfBodyList = await WorkListApiClient().getBasicDetNtfBodyList(workListData!.nOTIFICATIONID);
apiCallCount--;
if (apiCallCount == 0) {
Utils.hideLoading(context);
setState(() {});
}
} catch (ex) {
apiCallCount--;
Utils.hideLoading(context);
Utils.handleException(ex, context, null);
}
}
void getAbsenceNotificationBody() async {
try {
if (apiCallCount == 0) Utils.showLoading(context);
apiCallCount++;
getAbsenceCollectionNotificationBodyList = await WorkListApiClient().getAbsenceNotificationBody(workListData!.nOTIFICATIONID);
apiCallCount--;
if (apiCallCount == 0) {
Utils.hideLoading(context);
setState(() {});
}
} catch (ex) {
apiCallCount--;
Utils.hideLoading(context);
Utils.handleException(ex, context, null);
}
}
void getContactNotificationBody() async {
try {
if (apiCallCount == 0) Utils.showLoading(context);
apiCallCount++;
getContactNotificationBodyList = await WorkListApiClient().getContactNotificationBodyList(workListData!.nOTIFICATIONID);
apiCallCount--;
if (apiCallCount == 0) {
Utils.hideLoading(context);
setState(() {});
}
} catch (ex) {
apiCallCount--;
Utils.hideLoading(context);
Utils.handleException(ex, context, null);
}
}
void getStampNotificationBody() async {
try {
if (apiCallCount == 0) Utils.showLoading(context);
apiCallCount++;
if (workListData!.rEQUESTTYPE == "STAMP_MS") {
getStampMsNotifications = await WorkListApiClient().getStampMsNotificationBody(workListData!.nOTIFICATIONID!, -999);
} else {
getStampNsNotifications = await WorkListApiClient().getStampNsNotificationBody(workListData!.nOTIFICATIONID!, -999);
}
apiCallCount--;
if (apiCallCount == 0) {
Utils.hideLoading(context);
setState(() {});
}
} catch (ex) {
apiCallCount--;
Utils.hideLoading(context);
Utils.handleException(ex, context, null);
}
}
void getMoNotificationBody() async {
try {
if (apiCallCount == 0) Utils.showLoading(context);
apiCallCount++;
getMoNotificationBodyList = await WorkListApiClient().getMoNotificationBody(workListData!.nOTIFICATIONID!, -999);
apiCallCount--;
if (apiCallCount == 0) {
Utils.hideLoading(context);
setState(() {});
}
} catch (ex) {
apiCallCount--;
Utils.hideLoading(context);
Utils.handleException(ex, context, null);
}
}
void getItemCreationNtf() async {
try {
if (apiCallCount == 0) Utils.showLoading(context);
apiCallCount++;
getItemCreationNtfBody = await WorkListApiClient().getItemCreationNtfBody(workListData!.nOTIFICATIONID!, -999);
apiCallCount--;
if (apiCallCount == 0) {
Utils.hideLoading(context);
setState(() {});
}
} catch (ex) {
apiCallCount--;
Utils.hideLoading(context);
Utils.handleException(ex, context, null);
}
}
void getPoNotification() async {
try {
if (apiCallCount == 0) Utils.showLoading(context);
apiCallCount++;
getPoNotificationBody = await WorkListApiClient().getPoNotificationBody(workListData!.nOTIFICATIONID!, -999);
apiCallCount--;
if (apiCallCount == 0) {
Utils.hideLoading(context);
setState(() {});
}
} catch (ex) {
apiCallCount--;
Utils.hideLoading(context);
Utils.handleException(ex, context, null);
}
}
void getPRNotification() async {
try {
if (apiCallCount == 0) Utils.showLoading(context);
apiCallCount++;
getPrNotificationBody = await WorkListApiClient().getPRNotificationBody(workListData!.nOTIFICATIONID!, -999);
apiCallCount--;
if (apiCallCount == 0) {
Utils.hideLoading(context);
setState(() {});
}
} catch (ex) {
apiCallCount--;
Utils.hideLoading(context);
Utils.handleException(ex, context, null);
}
}
void notificationGetRespondAttributes() async {
try {
if (apiCallCount == 0) Utils.showLoading(context);
apiCallCount++;
getNotificationRespondAttributes = await WorkListApiClient().notificationGetRespondAttributes(workListData!.nOTIFICATIONID!);
if (getNotificationRespondAttributes.isNotEmpty) {
notificationNoteInput = getNotificationRespondAttributes.first;
}
apiCallCount--;
if (apiCallCount == 0) {
Utils.hideLoading(context);
setState(() {});
}
} catch (ex) {
apiCallCount--;
Utils.hideLoading(context);
Utils.handleException(ex, context, null);
}
}
void getNotificationButtons() async {
try {
if (apiCallCount == 0) Utils.showLoading(context);
apiCallCount++;
notificationButtonsList = await WorkListApiClient().getNotificationButtons(workListData!.nOTIFICATIONID!);
if (notificationButtonsList.isNotEmpty) {
isCloseAvailable = notificationButtonsList.any((element) => element.bUTTONACTION == "CLOSE");
isApproveAvailable = notificationButtonsList.any((element) => element.bUTTONACTION == "APPROVED");
isRejectAvailable = notificationButtonsList.any((element) => element.bUTTONACTION == "REJECTED");
}
apiCallCount--;
if (apiCallCount == 0) {
Utils.hideLoading(context);
setState(() {});
}
} catch (ex) {
apiCallCount--;
Utils.hideLoading(context);
Utils.handleException(ex, context, null);
}
}
void getActionHistory() async {
try {
if (apiCallCount == 0) Utils.showLoading(context);
apiCallCount++;
actionHistoryList = await WorkListApiClient().getActionHistory(workListData!.nOTIFICATIONID!);
apiCallCount--;
if (apiCallCount == 0) {
Utils.hideLoading(context);
setState(() {});
}
} catch (ex) {
apiCallCount--;
Utils.hideLoading(context);
Utils.handleException(ex, context, null);
}
}
void getAttachments() async {
try {
// if (apiCallCount == 0) Utils.showLoading(context);
// apiCallCount++;
getAttachmentList = await WorkListApiClient().getAttachments(workListData!.nOTIFICATIONID!);
// apiCallCount--;
// if (apiCallCount == 0) {
// Utils.hideLoading(context);
setState(() {});
// }
} catch (ex) {
// apiCallCount--;
// Utils.hideLoading(context);
Utils.handleException(ex, context, null);
}
}
}

@ -71,7 +71,9 @@ class ActionsFragment extends StatelessWidget {
Row(
crossAxisAlignment: CrossAxisAlignment.start,
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,
Expanded(
child: Column(
@ -129,10 +131,10 @@ class ActionsFragment extends StatelessWidget {
return MyColors.redColor;
} else if (code == "PENDING") {
return MyColors.orange;
} else if (code == "APPROVED") {
} else if (code == "APPROVED" || code == "APPROVE") {
return const Color(0xff1FA269);
} else if (code != "SUBMIT" && code != "REJECT" && code != "PENDING") {
return const Color(0xff1FA269);
return MyColors.orange;
} else if (code == "REQUEST_INFO") {
return const Color(0xff2E303A);
} else {

@ -1,5 +1,6 @@
import 'package:easy_localization/src/public_ext.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/extensions/int_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_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_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_ns_notification_body_list_model.dart';
import 'package:mohem_flutter_app/models/worklist/hr/eit_otification_body_model.dart';
@ -28,19 +30,20 @@ class InfoFragment extends StatelessWidget {
List<GetBasicDetNtfBodyList>? getBasicDetNtfBodyList;
List<GetAbsenceCollectionNotificationBodyList>? getAbsenceCollectionNotificationBodyList;
GetContactNotificationBodyList? getContactNotificationBodyList;
GetPrNotificationBodyList? getPrNotificationBodyList;
InfoFragment({
this.workListData,
this.poHeaderList = const <POHeader>[],
this.itemCreationHeader = const <ItemCreationHeader>[],
this.getStampMsNotifications,
this.getStampNsNotifications,
this.getEitCollectionNotificationBodyList,
this.getPhonesNotificationBodyList,
this.getBasicDetNtfBodyList,
this.getAbsenceCollectionNotificationBodyList,
this.getContactNotificationBodyList,
});
InfoFragment(
{this.workListData,
this.poHeaderList = const <POHeader>[],
this.itemCreationHeader = const <ItemCreationHeader>[],
this.getStampMsNotifications,
this.getStampNsNotifications,
this.getEitCollectionNotificationBodyList,
this.getPhonesNotificationBodyList,
this.getBasicDetNtfBodyList,
this.getAbsenceCollectionNotificationBodyList,
this.getContactNotificationBodyList,
this.getPrNotificationBodyList});
double itemHeight = 0;
double itemWidth = 0;
@ -76,8 +79,9 @@ class InfoFragment extends StatelessWidget {
),
],
).objectContainerView(),
if (getStampMsNotifications?.isNotEmpty ?? false) getStampMsNotificationsListView(getStampMsNotifications ?? []).objectContainerView(title: "Stamp Notifications"),
if (getStampNsNotifications?.isNotEmpty ?? false) getStampNsNotificationsListView(getStampNsNotifications ?? []).objectContainerView(title: "Stamp Notifications"),
if (getPrNotificationBodyList != null) getPRNotificationBodyListWidget(getPrNotificationBodyList!),
if (getStampMsNotifications?.isNotEmpty ?? false) getStampMsNotificationsListView(getStampMsNotifications ?? []),
if (getStampNsNotifications?.isNotEmpty ?? false) getStampNsNotificationsListView(getStampNsNotifications ?? []),
if (poHeaderList.isNotEmpty) getPoNotificationsListView(),
if (itemCreationHeader.isNotEmpty) getItemCreationHeaderView(),
if (getEitCollectionNotificationBodyList?.isNotEmpty ?? false) getEitNotificationsListView(getEitCollectionNotificationBodyList ?? []),
@ -218,8 +222,8 @@ class InfoFragment extends StatelessWidget {
isItLast: true,
),
],
),
separatorBuilder: (cxt, index) => 1.divider.paddingOnly(top: 8, bottom: 8),
).objectContainerView(),
separatorBuilder: (cxt, index) => 1.height.paddingOnly(top: 8, bottom: 8),
itemCount: list.length);
}
@ -240,8 +244,8 @@ class InfoFragment extends StatelessWidget {
isItLast: true,
),
],
),
separatorBuilder: (cxt, index) => 1.divider.paddingOnly(top: 8, bottom: 8),
).objectContainerView(),
separatorBuilder: (cxt, index) => 1.height.paddingOnly(top: 8, bottom: 8),
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) {
bool isOdd = false;
try {

@ -1,12 +1,16 @@
import 'package:easy_localization/src/public_ext.dart';
import 'package:expandable/expandable.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/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/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_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/widgets/button/default_button.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<ItemCreationLines> itemCreationLines;
final List<POLines> poLinesList;
final List<PRLines> prLinesList;
RequestFragment({
Key? key,
this.moNotificationBodyList = const <GetMoNotificationBodyList>[],
this.itemCreationLines = const <ItemCreationLines>[],
this.poLinesList = const <POLines>[],
this.prLinesList = const <PRLines>[],
}) : super(key: key);
@override
@ -33,72 +39,114 @@ class RequestFragment extends StatelessWidget {
if (moNotificationBodyList.isNotEmpty) moNotificationDataView(),
if (poLinesList.isNotEmpty) poLinesDataView(),
if (itemCreationLines.isNotEmpty) itemCreationLinesView(),
if (prLinesList.isNotEmpty) prLinesDataView(),
],
),
);
}
Widget poLinesDataView() {
return ListView.separated(
shrinkWrap: true,
physics: const NeverScrollableScrollPhysics(),
itemBuilder: (cxt, index) => Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
ItemDetailGrid(
ItemDetailViewCol(LocaleKeys.code.tr(), poLinesList[index].iTEMCODE ?? ""),
ItemDetailViewCol(LocaleKeys.mfg.tr(), poLinesList[index].uOM ?? ""),
),
ItemDetailGrid(
ItemDetailViewCol(LocaleKeys.lineType.tr(), poLinesList[index].qUANTITY?.toString() ?? ""),
ItemDetailViewCol(LocaleKeys.unit.tr(), poLinesList[index].uOM ?? ""),
),
ItemDetailGrid(
ItemDetailViewCol(LocaleKeys.price.tr(), poLinesList[index].uNITPRICE?.toString() ?? ""),
ItemDetailViewCol(LocaleKeys.lineAmount.tr(), poLinesList[index].lINEAMOUNT?.toString() ?? ""),
),
ItemDetailGrid(
ItemDetailViewCol(LocaleKeys.quantity.tr(), poLinesList[index].qUANTITY?.toString() ?? ""),
ItemDetailViewCol(LocaleKeys.lineDiscount.tr(), poLinesList[index].lINEDISCPERCENTAGE?.toString() ?? ""),
),
ItemDetailGrid(
ItemDetailViewCol(LocaleKeys.needByDate.tr(), poLinesList[index].nEEDBYDATE ?? ""),
ItemDetailViewCol(LocaleKeys.promisedDate.tr(), poLinesList[index].pROMISEDDATE ?? ""),
),
ItemDetailGrid(
ItemDetailViewCol(LocaleKeys.deliverToLocation.tr(), poLinesList[index].dELIVERTOLOCATION ?? ""),
ItemDetailViewCol(LocaleKeys.requisitionNumber.tr(), poLinesList[index].rEQUESTOR ?? ""),
),
ItemDetailGrid(
ItemDetailViewCol(LocaleKeys.requester.tr(), poLinesList[index].pRNUM ?? ""),
Container(),
),
12.height,
Row(
return ExpandableNotifier(
child: ListView.separated(
shrinkWrap: true,
physics: const NeverScrollableScrollPhysics(),
itemBuilder: (cxt, index) => ExpandablePanel(
header: poLinesList[index].iTEMDESCRIPTION!.toText14(),
collapsed: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
DefaultButton(LocaleKeys.itemHistory.tr(), () {
Navigator.pushNamed(
cxt,
AppRoutes.itemHistory,
arguments: ItemHistoryScreenParams(title: LocaleKeys.itemHistory.tr(), isMO: false, pItemId: poLinesList[index].iTEMID),
);
}).expanded,
12.width,
DefaultButton(LocaleKeys.quotationAnalysis.tr(), () {
Navigator.pushNamed(
cxt,
AppRoutes.itemHistory,
arguments: ItemHistoryScreenParams(
isItemHistory: false, isMO: false, title: LocaleKeys.quotationAnalysis.tr(), pItemId: poLinesList[index].iTEMID, pPoHeaderId: poLinesList[index].pOHEADERID),
);
}).expanded,
ItemDetailGrid(
ItemDetailViewCol(LocaleKeys.code.tr(), poLinesList[index].iTEMCODE ?? ""),
ItemDetailViewCol(LocaleKeys.mfg.tr(), poLinesList[index].uOM ?? ""),
),
ItemDetailGrid(
ItemDetailViewCol(LocaleKeys.lineType.tr(), poLinesList[index].qUANTITY?.toString() ?? ""),
ItemDetailViewCol(LocaleKeys.unit.tr(), poLinesList[index].uOM ?? ""),
),
ItemDetailGrid(
ItemDetailViewCol(LocaleKeys.price.tr(), poLinesList[index].uNITPRICE?.toString() ?? ""),
ItemDetailViewCol(LocaleKeys.lineAmount.tr(), poLinesList[index].lINEAMOUNT?.toString() ?? ""),
),
ItemDetailGrid(
ItemDetailViewCol(LocaleKeys.quantity.tr(), poLinesList[index].qUANTITY?.toString() ?? ""),
ItemDetailViewCol(LocaleKeys.lineDiscount.tr(), poLinesList[index].lINEDISCPERCENTAGE?.toString() ?? ""),
),
ItemDetailGrid(
ItemDetailViewCol(LocaleKeys.needByDate.tr(), poLinesList[index].nEEDBYDATE ?? ""),
ItemDetailViewCol(LocaleKeys.promisedDate.tr(), poLinesList[index].pROMISEDDATE ?? ""),
),
ItemDetailGrid(
ItemDetailViewCol(LocaleKeys.deliverToLocation.tr(), poLinesList[index].dELIVERTOLOCATION ?? ""),
ItemDetailViewCol(LocaleKeys.requisitionNumber.tr(), poLinesList[index].rEQUESTOR ?? ""),
),
ItemDetailGrid(
ItemDetailViewCol(LocaleKeys.requester.tr(), poLinesList[index].pRNUM ?? ""),
Container(),
),
12.height,
Row(
children: [
DefaultButton(LocaleKeys.itemHistory.tr(), () {
Navigator.pushNamed(
cxt,
AppRoutes.itemHistory,
arguments: ItemHistoryScreenParams(title: LocaleKeys.itemHistory.tr(), isMO: false, pItemId: poLinesList[index].iTEMID),
);
}).expanded,
12.width,
DefaultButton(LocaleKeys.quotationAnalysis.tr(), () {
Navigator.pushNamed(
cxt,
AppRoutes.itemHistory,
arguments: ItemHistoryScreenParams(
isItemHistory: false, isMO: false, title: LocaleKeys.quotationAnalysis.tr(), pItemId: poLinesList[index].iTEMID, pPoHeaderId: poLinesList[index].pOHEADERID),
);
}).expanded,
],
)
],
)
],
).objectContainerView(title: poLinesList[index].iTEMDESCRIPTION!),
separatorBuilder: (cxt, index) => 12.height,
itemCount: poLinesList.length);
),
expanded: const SizedBox(),
).objectContainerView(),
separatorBuilder: (cxt, index) => 12.height,
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() {

@ -8,8 +8,9 @@ class AttachmentOptions extends StatelessWidget {
VoidCallback onCameraTap;
VoidCallback onGalleryTap;
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
Widget build(BuildContext context) {
@ -28,7 +29,7 @@ class AttachmentOptions extends StatelessWidget {
children: [
itemView("open_camera.svg", "Open\nCamera", onCameraTap),
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:flutter/cupertino.dart';
import 'package:flutter/material.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/app_state/app_state.dart';
import 'package:mohem_flutter_app/classes/colors.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/string_extensions.dart';
import 'package:mohem_flutter_app/extensions/widget_extensions.dart';
import 'package:mohem_flutter_app/generated/locale_keys.g.dart';
import 'package:mohem_flutter_app/models/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/worklist/get_favorite_replacements_model.dart';
import 'package:mohem_flutter_app/models/worklist/replacement_list_model.dart';
@ -21,17 +28,19 @@ class SearchEmployeeBottomSheet extends StatefulWidget {
String title, apiMode;
List<GetActionHistoryList>? actionHistoryList;
Function(ReplacementList) onSelectEmployee;
bool fromChat;
SearchEmployeeBottomSheet(
{required this.title,
required this.apiMode,
this.notificationID,
this.actionHistoryList,
required this.onSelectEmployee});
SearchEmployeeBottomSheet({
required this.title,
required this.apiMode,
this.notificationID,
this.actionHistoryList,
required this.onSelectEmployee,
required this.fromChat,
});
@override
State<SearchEmployeeBottomSheet> createState() =>
_SearchEmployeeBottomSheetState();
State<SearchEmployeeBottomSheet> createState() => _SearchEmployeeBottomSheetState();
}
class _SearchEmployeeBottomSheetState extends State<SearchEmployeeBottomSheet> {
@ -49,6 +58,9 @@ class _SearchEmployeeBottomSheetState extends State<SearchEmployeeBottomSheet> {
List<ReplacementList>? favouriteUserList;
List<ReplacementList>? nonFavouriteUserList;
// Chat Items
List<ChatUser>? chatUsersList = [];
int _selectedSearchIndex = 0;
void fetchUserByInput({bool isNeedLoading = true}) async {
@ -59,12 +71,24 @@ class _SearchEmployeeBottomSheetState extends State<SearchEmployeeBottomSheet> {
userId: _selectedSearchIndex == 1 ? searchText : "",
email: _selectedSearchIndex == 2 ? searchText : "",
);
favouriteUserList = replacementList
?.where((element) => element.isFavorite ?? false)
.toList();
nonFavouriteUserList = replacementList
?.where((element) => !(element.isFavorite ?? false))
.toList();
favouriteUserList = replacementList?.where((element) => element.isFavorite ?? false).toList();
nonFavouriteUserList = replacementList?.where((element) => !(element.isFavorite ?? false)).toList();
Utils.hideLoading(context);
setState(() {});
} catch (e) {
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);
setState(() {});
} catch (e) {
@ -114,9 +138,8 @@ class _SearchEmployeeBottomSheetState extends State<SearchEmployeeBottomSheet> {
IconButton(
constraints: const BoxConstraints(),
onPressed: () async {
await SystemChannels.textInput
.invokeMethod('TextInput.hide');
fetchUserByInput();
await SystemChannels.textInput.invokeMethod('TextInput.hide');
widget.fromChat ? fetchChatUser() : fetchUserByInput();
},
icon: Icon(Icons.search))
],
@ -134,8 +157,7 @@ class _SearchEmployeeBottomSheetState extends State<SearchEmployeeBottomSheet> {
ListView.separated(
physics: const NeverScrollableScrollPhysics(),
shrinkWrap: true,
itemBuilder: (cxt, index) =>
employeeItemView(favouriteUserList![index]),
itemBuilder: (cxt, index) => employeeItemView(favouriteUserList![index]),
separatorBuilder: (cxt, index) => Container(
height: 1,
color: MyColors.borderE3Color,
@ -149,8 +171,7 @@ class _SearchEmployeeBottomSheetState extends State<SearchEmployeeBottomSheet> {
ListView.separated(
physics: const NeverScrollableScrollPhysics(),
shrinkWrap: true,
itemBuilder: (cxt, index) => employeeItemView(
nonFavouriteUserList![index]),
itemBuilder: (cxt, index) => employeeItemView(nonFavouriteUserList![index]),
separatorBuilder: (cxt, index) => Container(
height: 1,
color: MyColors.borderE3Color,
@ -158,13 +179,68 @@ class _SearchEmployeeBottomSheetState extends State<SearchEmployeeBottomSheet> {
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,
Container(
width: double.infinity,
height: 1,
color: MyColors.lightGreyEFColor),
Container(width: double.infinity, height: 1, color: MyColors.lightGreyEFColor),
DefaultButton(
LocaleKeys.cancel.tr(),
() {
@ -201,11 +277,7 @@ class _SearchEmployeeBottomSheetState extends State<SearchEmployeeBottomSheet> {
Expanded(
child: (replacement.employeeDisplayName ?? "").toText12(),
),
Icon(Icons.star,
size: 16,
color: replacement.isFavorite!
? MyColors.yellowFavColor
: MyColors.borderCEColor),
Icon(Icons.star, size: 16, color: replacement.isFavorite! ? MyColors.yellowFavColor : MyColors.borderCEColor),
],
),
),
@ -228,9 +300,7 @@ class _SearchEmployeeBottomSheetState extends State<SearchEmployeeBottomSheet> {
width: double.infinity,
height: double.infinity,
decoration: BoxDecoration(
color: value == groupValue
? MyColors.grey3AColor
: Colors.transparent,
color: value == groupValue ? MyColors.grey3AColor : Colors.transparent,
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 NotificationGetRespondAttributesList? notificationGetRespond;
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 = "";

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

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

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

Loading…
Cancel
Save