|
|
|
|
@ -1,11 +1,16 @@
|
|
|
|
|
import 'dart:io';
|
|
|
|
|
|
|
|
|
|
import 'package:easy_localization/easy_localization.dart';
|
|
|
|
|
import 'package:easy_localization/src/public_ext.dart';
|
|
|
|
|
import 'package:flutter/cupertino.dart';
|
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
import 'package:mohem_flutter_app/api/leave_balance_api_client.dart';
|
|
|
|
|
import 'package:mohem_flutter_app/api/profile_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/dyanmic_forms/validate_eit_transaction_model.dart';
|
|
|
|
|
@ -17,11 +22,8 @@ import 'package:mohem_flutter_app/models/profile/get_contact_details_list.dart';
|
|
|
|
|
import 'package:mohem_flutter_app/models/profile/submit_contact_transaction_list_model.dart';
|
|
|
|
|
import 'package:mohem_flutter_app/ui/misc/request_submit_screen.dart';
|
|
|
|
|
import 'package:mohem_flutter_app/widgets/app_bar_widget.dart';
|
|
|
|
|
import 'dart:io';
|
|
|
|
|
import 'package:flutter/cupertino.dart';
|
|
|
|
|
import 'package:mohem_flutter_app/widgets/button/default_button.dart';
|
|
|
|
|
import 'package:mohem_flutter_app/widgets/dynamic_forms/dynamic_textfield_widget.dart';
|
|
|
|
|
import 'package:easy_localization/src/public_ext.dart';
|
|
|
|
|
|
|
|
|
|
class FamilyMemberScreenParams {
|
|
|
|
|
String? actionType;
|
|
|
|
|
@ -44,6 +46,7 @@ class _AddUpdateFamilyMemberState extends State<AddUpdateFamilyMember> {
|
|
|
|
|
List<GetContactDffStructureList?> getContactDffStructureList = [];
|
|
|
|
|
List<GetContactDetailsList?> getContactDetailsList = [];
|
|
|
|
|
SubmitContactTransactionList? submitContactTransactionList;
|
|
|
|
|
|
|
|
|
|
//dynamic args;
|
|
|
|
|
FamilyMemberScreenParams? params;
|
|
|
|
|
String? date = "MM/DD/YYYY";
|
|
|
|
|
@ -110,33 +113,37 @@ class _AddUpdateFamilyMemberState extends State<AddUpdateFamilyMember> {
|
|
|
|
|
body: params!.flag == 1
|
|
|
|
|
? Column(
|
|
|
|
|
children: [
|
|
|
|
|
ListView(physics: const BouncingScrollPhysics(), padding: const EdgeInsets.all(21), children: [
|
|
|
|
|
ListView.separated(
|
|
|
|
|
physics: const NeverScrollableScrollPhysics(),
|
|
|
|
|
shrinkWrap: true,
|
|
|
|
|
itemBuilder: (BuildContext cxt, int parentIndex) {
|
|
|
|
|
return parseDynamicFormatTypeCols(getContactColsStructureList![parentIndex], parentIndex);
|
|
|
|
|
},
|
|
|
|
|
separatorBuilder: (BuildContext cxt, int index) => 0.height,
|
|
|
|
|
itemCount: getContactColsStructureList!.length),
|
|
|
|
|
12.height,
|
|
|
|
|
ListView.separated(
|
|
|
|
|
physics: const NeverScrollableScrollPhysics(),
|
|
|
|
|
shrinkWrap: true,
|
|
|
|
|
itemBuilder: (BuildContext cxt, int parentIndex) {
|
|
|
|
|
return parseDynamicFormatTypeBasicDetDff(getBasicDetDffStructureList![parentIndex], parentIndex);
|
|
|
|
|
},
|
|
|
|
|
separatorBuilder: (BuildContext cxt, int index) => 0.height,
|
|
|
|
|
itemCount: getBasicDetDffStructureList!.length),
|
|
|
|
|
ListView.separated(
|
|
|
|
|
physics: const NeverScrollableScrollPhysics(),
|
|
|
|
|
shrinkWrap: true,
|
|
|
|
|
itemBuilder: (BuildContext cxt, int parentIndex) {
|
|
|
|
|
return parseDynamicFormatTypeContactDff(getContactDffStructureList![parentIndex], parentIndex);
|
|
|
|
|
},
|
|
|
|
|
separatorBuilder: (BuildContext cxt, int index) => 0.height,
|
|
|
|
|
itemCount: getContactDffStructureList!.length),
|
|
|
|
|
],).expanded,
|
|
|
|
|
ListView(
|
|
|
|
|
physics: const BouncingScrollPhysics(),
|
|
|
|
|
padding: const EdgeInsets.all(21),
|
|
|
|
|
children: [
|
|
|
|
|
ListView.separated(
|
|
|
|
|
physics: const NeverScrollableScrollPhysics(),
|
|
|
|
|
shrinkWrap: true,
|
|
|
|
|
itemBuilder: (BuildContext cxt, int parentIndex) {
|
|
|
|
|
return parseDynamicFormatTypeCols(getContactColsStructureList![parentIndex], parentIndex);
|
|
|
|
|
},
|
|
|
|
|
separatorBuilder: (BuildContext cxt, int index) => 0.height,
|
|
|
|
|
itemCount: getContactColsStructureList!.length),
|
|
|
|
|
12.height,
|
|
|
|
|
ListView.separated(
|
|
|
|
|
physics: const NeverScrollableScrollPhysics(),
|
|
|
|
|
shrinkWrap: true,
|
|
|
|
|
itemBuilder: (BuildContext cxt, int parentIndex) {
|
|
|
|
|
return parseDynamicFormatTypeBasicDetDff(getBasicDetDffStructureList![parentIndex], parentIndex);
|
|
|
|
|
},
|
|
|
|
|
separatorBuilder: (BuildContext cxt, int index) => 0.height,
|
|
|
|
|
itemCount: getBasicDetDffStructureList!.length),
|
|
|
|
|
ListView.separated(
|
|
|
|
|
physics: const NeverScrollableScrollPhysics(),
|
|
|
|
|
shrinkWrap: true,
|
|
|
|
|
itemBuilder: (BuildContext cxt, int parentIndex) {
|
|
|
|
|
return parseDynamicFormatTypeContactDff(getContactDffStructureList![parentIndex], parentIndex);
|
|
|
|
|
},
|
|
|
|
|
separatorBuilder: (BuildContext cxt, int index) => 0.height,
|
|
|
|
|
itemCount: getContactDffStructureList!.length),
|
|
|
|
|
],
|
|
|
|
|
).expanded,
|
|
|
|
|
DefaultButton(LocaleKeys.next.tr(), () async {
|
|
|
|
|
submitUpdateForm();
|
|
|
|
|
}).insideContainer,
|
|
|
|
|
@ -189,21 +196,22 @@ class _AddUpdateFamilyMemberState extends State<AddUpdateFamilyMember> {
|
|
|
|
|
if (model.dATATYPE == "VARCHAR2") {
|
|
|
|
|
if (model!.objectValuesList?.isNotEmpty ?? false) {
|
|
|
|
|
return PopupMenuButton(
|
|
|
|
|
child: DynamicTextFieldWidget(
|
|
|
|
|
(model!.sEGMENTPROMPT ?? "") + (model!.rEQUIREDFLAG == "Y" ? "*" : ""),
|
|
|
|
|
model!.getContactDetailsList!.sEGMENTVALUEDSP ?? "",
|
|
|
|
|
isEnable: false,
|
|
|
|
|
isPopup: true,
|
|
|
|
|
).paddingOnly(bottom: 12),
|
|
|
|
|
itemBuilder: (_) => <PopupMenuItem<int>>[
|
|
|
|
|
for (int i = 0; i < getContactColsStructureList[index]!.objectValuesList!.length; i++)
|
|
|
|
|
PopupMenuItem<int>(child: Text(getContactColsStructureList[index]!.objectValuesList![i].mEANING.toString()), value: i),
|
|
|
|
|
],
|
|
|
|
|
onSelected: (int popupIndex) {
|
|
|
|
|
model.getContactDetailsList!.sEGMENTVALUEDSP = getContactColsStructureList[index]!.objectValuesList![popupIndex].mEANING.toString();
|
|
|
|
|
model.getContactDetailsList!.vARCHAR2VALUE = getContactColsStructureList[index]!.objectValuesList![popupIndex].cODE.toString();
|
|
|
|
|
setState(() {});
|
|
|
|
|
},);
|
|
|
|
|
child: DynamicTextFieldWidget(
|
|
|
|
|
(model!.sEGMENTPROMPT ?? "") + (model!.rEQUIREDFLAG == "Y" ? "*" : ""),
|
|
|
|
|
model!.getContactDetailsList!.sEGMENTVALUEDSP ?? "",
|
|
|
|
|
isEnable: false,
|
|
|
|
|
isPopup: true,
|
|
|
|
|
).paddingOnly(bottom: 12),
|
|
|
|
|
itemBuilder: (_) => <PopupMenuItem<int>>[
|
|
|
|
|
for (int i = 0; i < getContactColsStructureList[index]!.objectValuesList!.length; i++)
|
|
|
|
|
PopupMenuItem<int>(child: Text(getContactColsStructureList[index]!.objectValuesList![i].mEANING.toString()), value: i),
|
|
|
|
|
],
|
|
|
|
|
onSelected: (int popupIndex) {
|
|
|
|
|
model.getContactDetailsList!.sEGMENTVALUEDSP = getContactColsStructureList[index]!.objectValuesList![popupIndex].mEANING.toString();
|
|
|
|
|
model.getContactDetailsList!.vARCHAR2VALUE = getContactColsStructureList[index]!.objectValuesList![popupIndex].cODE.toString();
|
|
|
|
|
setState(() {});
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
} else {
|
|
|
|
|
return DynamicTextFieldWidget(
|
|
|
|
|
(model!.sEGMENTPROMPT ?? "") + (model!.rEQUIREDFLAG == "Y" ? "*" : ""),
|
|
|
|
|
@ -247,22 +255,23 @@ class _AddUpdateFamilyMemberState extends State<AddUpdateFamilyMember> {
|
|
|
|
|
if (model!.fORMATTYPE == "C") {
|
|
|
|
|
if (model!.eSERVICESVS?.isNotEmpty ?? false) {
|
|
|
|
|
return PopupMenuButton(
|
|
|
|
|
child: DynamicTextFieldWidget(
|
|
|
|
|
(model.sEGMENTPROMPT ?? "") + (model.rEQUIREDFLAG == "Y" ? "*" : ""),
|
|
|
|
|
model.getContactDetailsList!.sEGMENTVALUEDSP ?? "",
|
|
|
|
|
isEnable: false,
|
|
|
|
|
isPopup: true,
|
|
|
|
|
).paddingOnly(bottom: 12),
|
|
|
|
|
itemBuilder: (_) => <PopupMenuItem<int>>[
|
|
|
|
|
for (int i = 0; i < getBasicDetDffStructureList[index]!.eSERVICESVS!.length; i++)
|
|
|
|
|
PopupMenuItem<int>(child: Text(getBasicDetDffStructureList[index]!.eSERVICESVS![i].vALUECOLUMNNAME.toString()), value: i),
|
|
|
|
|
],
|
|
|
|
|
onSelected: (int popupIndex) {
|
|
|
|
|
model.getContactDetailsList!.sEGMENTVALUEDSP = getBasicDetDffStructureList[index]!.eSERVICESVS![popupIndex].vALUECOLUMNNAME.toString();
|
|
|
|
|
model.getContactDetailsList!.vARCHAR2VALUE = getBasicDetDffStructureList[index]!.eSERVICESVS![popupIndex].iDCOLUMNNAME.toString();
|
|
|
|
|
child: DynamicTextFieldWidget(
|
|
|
|
|
(model.sEGMENTPROMPT ?? "") + (model.rEQUIREDFLAG == "Y" ? "*" : ""),
|
|
|
|
|
model.getContactDetailsList!.sEGMENTVALUEDSP ?? "",
|
|
|
|
|
isEnable: false,
|
|
|
|
|
isPopup: true,
|
|
|
|
|
).paddingOnly(bottom: 12),
|
|
|
|
|
itemBuilder: (_) => <PopupMenuItem<int>>[
|
|
|
|
|
for (int i = 0; i < getBasicDetDffStructureList[index]!.eSERVICESVS!.length; i++)
|
|
|
|
|
PopupMenuItem<int>(child: Text(getBasicDetDffStructureList[index]!.eSERVICESVS![i].vALUECOLUMNNAME.toString()), value: i),
|
|
|
|
|
],
|
|
|
|
|
onSelected: (int popupIndex) {
|
|
|
|
|
model.getContactDetailsList!.sEGMENTVALUEDSP = getBasicDetDffStructureList[index]!.eSERVICESVS![popupIndex].vALUECOLUMNNAME.toString();
|
|
|
|
|
model.getContactDetailsList!.vARCHAR2VALUE = getBasicDetDffStructureList[index]!.eSERVICESVS![popupIndex].iDCOLUMNNAME.toString();
|
|
|
|
|
|
|
|
|
|
setState(() {});
|
|
|
|
|
},);
|
|
|
|
|
setState(() {});
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
} else {
|
|
|
|
|
return DynamicTextFieldWidget(
|
|
|
|
|
(model.sEGMENTPROMPT ?? "") + (model.rEQUIREDFLAG == "Y" ? "*" : ""),
|
|
|
|
|
@ -306,21 +315,22 @@ class _AddUpdateFamilyMemberState extends State<AddUpdateFamilyMember> {
|
|
|
|
|
if (model!.fORMATTYPE == "C") {
|
|
|
|
|
if (model.eSERVICESVS?.isNotEmpty ?? false) {
|
|
|
|
|
return PopupMenuButton(
|
|
|
|
|
child: DynamicTextFieldWidget(
|
|
|
|
|
(model!.sEGMENTPROMPT ?? "") + (model!.rEQUIREDFLAG == "Y" ? "*" : ""),
|
|
|
|
|
model!.getContactDetailsList!.sEGMENTVALUEDSP ?? "",
|
|
|
|
|
isEnable: false,
|
|
|
|
|
isPopup: true,
|
|
|
|
|
).paddingOnly(bottom: 12),
|
|
|
|
|
itemBuilder: (_) => <PopupMenuItem<int>>[
|
|
|
|
|
for (int i = 0; i < getContactDffStructureList[index]!.eSERVICESVS!.length; i++)
|
|
|
|
|
PopupMenuItem<int>(child: Text(getContactDffStructureList[index]!.eSERVICESVS![i].vALUECOLUMNNAME.toString()), value: i),
|
|
|
|
|
],
|
|
|
|
|
onSelected: (int popupIndex) {
|
|
|
|
|
model.getContactDetailsList!.sEGMENTVALUEDSP = getContactDffStructureList[index]!.eSERVICESVS![popupIndex].vALUECOLUMNNAME.toString();
|
|
|
|
|
model.getContactDetailsList!.vARCHAR2VALUE = getContactDffStructureList[index]!.eSERVICESVS![popupIndex].iDCOLUMNNAME.toString();
|
|
|
|
|
setState(() {});
|
|
|
|
|
},);
|
|
|
|
|
child: DynamicTextFieldWidget(
|
|
|
|
|
(model!.sEGMENTPROMPT ?? "") + (model!.rEQUIREDFLAG == "Y" ? "*" : ""),
|
|
|
|
|
model!.getContactDetailsList!.sEGMENTVALUEDSP ?? "",
|
|
|
|
|
isEnable: false,
|
|
|
|
|
isPopup: true,
|
|
|
|
|
).paddingOnly(bottom: 12),
|
|
|
|
|
itemBuilder: (_) => <PopupMenuItem<int>>[
|
|
|
|
|
for (int i = 0; i < getContactDffStructureList[index]!.eSERVICESVS!.length; i++)
|
|
|
|
|
PopupMenuItem<int>(child: Text(getContactDffStructureList[index]!.eSERVICESVS![i].vALUECOLUMNNAME.toString()), value: i),
|
|
|
|
|
],
|
|
|
|
|
onSelected: (int popupIndex) {
|
|
|
|
|
model.getContactDetailsList!.sEGMENTVALUEDSP = getContactDffStructureList[index]!.eSERVICESVS![popupIndex].vALUECOLUMNNAME.toString();
|
|
|
|
|
model.getContactDetailsList!.vARCHAR2VALUE = getContactDffStructureList[index]!.eSERVICESVS![popupIndex].iDCOLUMNNAME.toString();
|
|
|
|
|
setState(() {});
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
} else {
|
|
|
|
|
return DynamicTextFieldWidget(
|
|
|
|
|
(model.sEGMENTPROMPT ?? "") + (model.rEQUIREDFLAG == "Y" ? "*" : ""),
|
|
|
|
|
@ -437,8 +447,9 @@ class _AddUpdateFamilyMemberState extends State<AddUpdateFamilyMember> {
|
|
|
|
|
}).toList();
|
|
|
|
|
List<Map<String, dynamic>> values3 = getContactColsStructureList!.map((e) {
|
|
|
|
|
String? dateVal = '';
|
|
|
|
|
dynamic? varChar1 = '';
|
|
|
|
|
String? varChar1 = '';
|
|
|
|
|
int? numberVal;
|
|
|
|
|
|
|
|
|
|
if (e!.dATATYPE == 'VARCHAR2') {
|
|
|
|
|
dateVal = null;
|
|
|
|
|
numberVal = null;
|
|
|
|
|
@ -460,12 +471,16 @@ class _AddUpdateFamilyMemberState extends State<AddUpdateFamilyMember> {
|
|
|
|
|
}).toList();
|
|
|
|
|
List<Map<String, dynamic>> valuesFinal = [...values1, ...values2, ...values3];
|
|
|
|
|
Utils.showLoading(context);
|
|
|
|
|
submitContactTransactionList = await ProfileApiClient().submitContactTransactionAddAndUpdate(params!.actionType.toString(), params!.relationID, valuesFinal);
|
|
|
|
|
int? transactionId = submitContactTransactionList!.pTRANSACTIONID;
|
|
|
|
|
String? itemKey = submitContactTransactionList!.pITEMKEY;
|
|
|
|
|
submitContactTransactionList = await ProfileApiClient().submitContactTransactionAddAndUpdate(params!.actionType!, params!.relationID, valuesFinal);
|
|
|
|
|
Utils.hideLoading(context);
|
|
|
|
|
await Navigator.pushNamed(context, AppRoutes.requestSubmitScreen,
|
|
|
|
|
arguments: RequestSubmitScreenParams(LocaleKeys.profile_familyDetails.tr(), submitContactTransactionList!.pTRANSACTIONID!, submitContactTransactionList!.pITEMKEY!, 'family_member'));
|
|
|
|
|
if (!AppState().cancelRequestTrancsection) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
Utils.showLoading(context);
|
|
|
|
|
await LeaveBalanceApiClient().cancelHrTransaction(submitContactTransactionList!.pTRANSACTIONID!);
|
|
|
|
|
Utils.hideLoading(context);
|
|
|
|
|
Navigator.pushNamed(context, AppRoutes.requestSubmitScreen,
|
|
|
|
|
arguments: RequestSubmitScreenParams(LocaleKeys.profile_familyDetails.tr(), transactionId!.toInt(), itemKey.toString(), 'family_member'));
|
|
|
|
|
setState(() {});
|
|
|
|
|
} catch (ex) {
|
|
|
|
|
Utils.hideLoading(context);
|
|
|
|
|
|