Merge branch 'master' into development_sikander

# Conflicts:
#	lib/ui/work_list/worklist_detail_screen.dart
merge-requests/23/head
Sikander Saleem 3 years ago
commit 27b5cbfdf6

@ -35,17 +35,19 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
await buildHubConnection();
}
void getChatMemberFromSearch(String sName, int cUserId) async {
isLoading = true;
notifyListeners();
Future<List<ChatUser>?> getChatMemberFromSearch(String sName, int cUserId) async {
Response response = await ApiClient().getJsonForResponse(
"${ApiConsts.chatSearchMember}$sName/$cUserId",
"${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}",
@ -64,13 +66,18 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
"${ApiConsts.chatServerBaseApiUrl}${ApiConsts.chatSingleUserHistoryUrl}/$senderUID/$receiverUID/$pagination",
token: AppState().chatDetails!.response!.token,
);
logger.d(response.body);
userChatHistory = getSingleUserChatintoModel(response.body);
logger.d(response.statusCode);
print(response.body);
if (response.statusCode == 204) {
userChatHistory = [];
} else {
userChatHistory = getSingleUserChatModel(response.body);
}
isLoading = false;
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));
@ -79,7 +86,9 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
hubConnection = await HubConnectionBuilder()
.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}) {
@ -159,7 +168,7 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
// print("================= Status Online // Offline ====================");
List items = args!.toList();
logger.d(items);
for (var user in searchedChats!) {
for (ChatUser user in searchedChats!) {
if (user.id == items.first["id"]) {
user.userStatus = items.first["userStatus"];
}
@ -172,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);
}
@ -185,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);

@ -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';
@ -235,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 = {

@ -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;
@ -985,7 +986,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) {
@ -1594,7 +1595,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;
}
}

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

@ -163,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) {

@ -52,7 +52,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,

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

@ -206,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,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;
@ -126,6 +126,10 @@ class _WorkListDetailScreenState extends State<WorkListDetailScreen> {
if (workListData!.iTEMTYPE == "POAPPRV") {
getPoNotification();
}
if (workListData!.iTEMTYPE == "REQAPPRV") {
getPrNotificationBody = await WorkListApiClient().getPRNotificationBody(workListData!.nOTIFICATIONID!, -999);
}
notificationGetRespondAttributes();
// List dataToFetch = await Future.wait([
@ -225,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)
@ -232,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),
@ -465,7 +471,9 @@ class _WorkListDetailScreenState extends State<WorkListDetailScreen> {
child: isIconAsset
? SvgPicture.asset(icon)
: Image.memory(
base64Decode(icon),
Utils.dataFromBase64String(
icon
),
fit: BoxFit.cover,
),
)
@ -474,27 +482,33 @@ class _WorkListDetailScreenState extends State<WorkListDetailScreen> {
}
void performAction(String actionMode) {
TextEditingController textEditingController = TextEditingController();
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_FORWARD_TO_USER_NAME": "",
"P_NOTIFICATION_ID": workListData!.nOTIFICATIONID,
"RespondAttributeList": [
if (notificationNoteInput != null)
{
"ATTRIBUTE_NAME": notificationNoteInput!.attributeName,
if (notificationNoteInput!.attributeType == "number") "ATTRIBUTE_NUMBER_VALUE": note else if (notificationNoteInput!.attributeType == "VARCHAR2") "ATTRIBUTE_TEXT_VALUE": note
}
],
};
performNotificationAction(payload);
if(note.isNotEmpty && (actionMode == "APPROVED" || actionMode == "APPROVE")) {
Map<String, dynamic> payload = {
"P_ACTION_MODE": actionMode,
"P_APPROVER_INDEX": null,
"P_COMMENTS": note,
"P_FORWARD_TO_USER_NAME": "",
"P_NOTIFICATION_ID": workListData!.nOTIFICATIONID,
"RespondAttributeList": [
if (notificationNoteInput != null)
{
"ATTRIBUTE_NAME": notificationNoteInput!.attributeName,
if (notificationNoteInput!.attributeType == "number") "ATTRIBUTE_NUMBER_VALUE": note else if (notificationNoteInput!.attributeType == "VARCHAR2") "ATTRIBUTE_TEXT_VALUE": note
}
],
};
performNotificationAction(payload);
} else {
Utils.showToast("Please enter comments");
}
},
),
);

@ -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,6 +1,7 @@
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';
@ -9,6 +10,7 @@ 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';
@ -17,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
@ -35,6 +39,7 @@ class RequestFragment extends StatelessWidget {
if (moNotificationBodyList.isNotEmpty) moNotificationDataView(),
if (poLinesList.isNotEmpty) poLinesDataView(),
if (itemCreationLines.isNotEmpty) itemCreationLinesView(),
if (prLinesList.isNotEmpty) prLinesDataView(),
],
),
);
@ -109,6 +114,41 @@ class RequestFragment extends StatelessWidget {
);
}
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() {
return ListView.separated(
shrinkWrap: true,

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

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

Loading…
Cancel
Save