|
|
|
|
@ -19,6 +19,14 @@ import 'package:mohem_flutter_app/widgets/app_bar_widget.dart';
|
|
|
|
|
import 'package:mohem_flutter_app/widgets/button/default_button.dart';
|
|
|
|
|
import 'package:mohem_flutter_app/widgets/dynamic_forms/dynamic_textfield_widget.dart';
|
|
|
|
|
|
|
|
|
|
class NewRequestModel {
|
|
|
|
|
int? groupID;
|
|
|
|
|
String? functionName;
|
|
|
|
|
String? prompt;
|
|
|
|
|
|
|
|
|
|
NewRequestModel({this.groupID, this.functionName, this.prompt});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
class NewRequest extends StatefulWidget {
|
|
|
|
|
const NewRequest({Key? key}) : super(key: key);
|
|
|
|
|
|
|
|
|
|
@ -34,7 +42,7 @@ class _NewRequestState extends State<NewRequest> {
|
|
|
|
|
List<GetEITDFFStructureList>? getCCPDFFStructureModelList;
|
|
|
|
|
|
|
|
|
|
DateTime selectedDate = DateTime.now();
|
|
|
|
|
int? groupId;
|
|
|
|
|
NewRequestModel? requestModel;
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
void initState() {
|
|
|
|
|
@ -43,9 +51,13 @@ class _NewRequestState extends State<NewRequest> {
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
if (groupId == null) {
|
|
|
|
|
groupId = ModalRoute.of(context)!.settings.arguments as int;
|
|
|
|
|
getConcurrentPrograms();
|
|
|
|
|
if (requestModel == null) {
|
|
|
|
|
requestModel = ModalRoute.of(context)!.settings.arguments as NewRequestModel;
|
|
|
|
|
if (requestModel!.groupID != null) {
|
|
|
|
|
getConcurrentPrograms();
|
|
|
|
|
} else {
|
|
|
|
|
getCCPDFFStructure(requestModel!.functionName);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return Scaffold(
|
|
|
|
|
@ -63,17 +75,17 @@ class _NewRequestState extends State<NewRequest> {
|
|
|
|
|
PopupMenuButton(
|
|
|
|
|
child: DynamicTextFieldWidget(
|
|
|
|
|
LocaleKeys.templateName.tr(),
|
|
|
|
|
selectedConcurrentProgramList?.uSERCONCURRENTPROGRAMNAME ?? LocaleKeys.selectTemplate.tr(),
|
|
|
|
|
selectedConcurrentProgramList?.uSERCONCURRENTPROGRAMNAME ?? requestModel?.prompt ?? LocaleKeys.selectTemplate.tr(),
|
|
|
|
|
isEnable: false,
|
|
|
|
|
isPopup: true,
|
|
|
|
|
isInputTypeNum: true,
|
|
|
|
|
isReadOnly: false,
|
|
|
|
|
isReadOnly:getConcurrentProgramsList.isEmpty? true:false,
|
|
|
|
|
).paddingOnly(bottom: 12),
|
|
|
|
|
itemBuilder: (_) => <PopupMenuItem<int>>[
|
|
|
|
|
for (int i = 0; i < getConcurrentProgramsList!.length; i++) PopupMenuItem<int>(child: Text(getConcurrentProgramsList![i].uSERCONCURRENTPROGRAMNAME!), value: i),
|
|
|
|
|
for (int i = 0; i < getConcurrentProgramsList.length; i++) PopupMenuItem<int>(child: Text(getConcurrentProgramsList[i].uSERCONCURRENTPROGRAMNAME!), value: i),
|
|
|
|
|
],
|
|
|
|
|
onSelected: (int popupIndex) {
|
|
|
|
|
selectedConcurrentProgramList = getConcurrentProgramsList![popupIndex];
|
|
|
|
|
selectedConcurrentProgramList = getConcurrentProgramsList[popupIndex];
|
|
|
|
|
getCCPDFFStructure(selectedConcurrentProgramList?.cONCURRENTPROGRAMNAME);
|
|
|
|
|
setState(() {});
|
|
|
|
|
}),
|
|
|
|
|
@ -106,8 +118,11 @@ class _NewRequestState extends State<NewRequest> {
|
|
|
|
|
List<Map<String, dynamic>> values = getCCPDFFStructureModelList!.map((e) {
|
|
|
|
|
String? dateVal = '';
|
|
|
|
|
String? vatcherVal = '';
|
|
|
|
|
print(e.aPPLICATIONCOLUMNNAME);
|
|
|
|
|
print(e.fORMATTYPE);
|
|
|
|
|
print(e.eSERVICESDV!.pIDCOLUMNNAME);
|
|
|
|
|
int? numberVal;
|
|
|
|
|
if (e!.fORMATTYPE == 'N') {
|
|
|
|
|
if (e.fORMATTYPE == 'N') {
|
|
|
|
|
dateVal = null;
|
|
|
|
|
vatcherVal = e.eSERVICESDV!.pIDCOLUMNNAME;
|
|
|
|
|
numberVal = null;
|
|
|
|
|
@ -115,6 +130,10 @@ class _NewRequestState extends State<NewRequest> {
|
|
|
|
|
dateVal = null;
|
|
|
|
|
vatcherVal = e.eSERVICESDV!.pIDCOLUMNNAME;
|
|
|
|
|
numberVal = null;
|
|
|
|
|
} else if (e.fORMATTYPE == 'C') {
|
|
|
|
|
dateVal = null;
|
|
|
|
|
numberVal = null;
|
|
|
|
|
vatcherVal = e.eSERVICESDV!.pIDCOLUMNNAME;
|
|
|
|
|
} else {
|
|
|
|
|
dateVal = null;
|
|
|
|
|
numberVal = null;
|
|
|
|
|
@ -123,13 +142,10 @@ class _NewRequestState extends State<NewRequest> {
|
|
|
|
|
return ValidateEitTransactionModel(dATEVALUE: dateVal, nAME: e.aPPLICATIONCOLUMNNAME, nUMBERVALUE: numberVal, tRANSACTIONNUMBER: 1, vARCHAR2VALUE: vatcherVal.toString()).toJson();
|
|
|
|
|
}).toList();
|
|
|
|
|
Utils.showLoading(context);
|
|
|
|
|
submitCcpTransactionList = await MyRequestsApiClient().getSubmitNewRequest(values);
|
|
|
|
|
getCCPTransactionsList = await MyRequestsApiClient().getCcpTransactions(values);
|
|
|
|
|
submitCcpTransactionList = await MyRequestsApiClient().getSubmitNewRequest(values, functionName: requestModel?.functionName ?? "HMG_EMP_BUS_TRIP_SET_SS");
|
|
|
|
|
getCCPTransactionsList = await MyRequestsApiClient().getCcpTransactions(values, functionName: requestModel?.functionName ?? "HMG_EMP_BUS_TRIP_SET_SS");
|
|
|
|
|
Utils.hideLoading(context);
|
|
|
|
|
Navigator.pushNamed(
|
|
|
|
|
context,
|
|
|
|
|
AppRoutes.myRequests,
|
|
|
|
|
);
|
|
|
|
|
Navigator.pushNamed(context, AppRoutes.myRequests, arguments: requestModel);
|
|
|
|
|
setState(() {});
|
|
|
|
|
} catch (ex) {
|
|
|
|
|
Utils.hideLoading(context);
|
|
|
|
|
@ -140,7 +156,7 @@ class _NewRequestState extends State<NewRequest> {
|
|
|
|
|
void getConcurrentPrograms() async {
|
|
|
|
|
try {
|
|
|
|
|
Utils.showLoading(context);
|
|
|
|
|
getConcurrentProgramsList = await MyRequestsApiClient().getConcurrentPrograms(groupId!);
|
|
|
|
|
getConcurrentProgramsList = await MyRequestsApiClient().getConcurrentPrograms(requestModel!.groupID!);
|
|
|
|
|
Utils.hideLoading(context);
|
|
|
|
|
setState(() {});
|
|
|
|
|
} catch (ex) {
|
|
|
|
|
|