Merge branch 'master' into fatima
# Conflicts: # assets/langs/ar-SA.json # assets/langs/en-US.json # lib/generated/locale_keys.g.dartmerge-requests/26/head
commit
f515c0b39a
@ -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,
|
||||||
|
};
|
||||||
|
}
|
||||||
@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue