Merge branch 'development_sikander' into 'master'
Development sikander See merge request mirza.shafique/mohem_flutter_app!63merge-requests/1/merge
commit
0fdafcd7fc
@ -0,0 +1,45 @@
|
||||
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/models/generic_response_model.dart';
|
||||
import 'package:mohem_flutter_app/models/leave_balance/get_absence_attendance_types_list_model.dart';
|
||||
import 'package:mohem_flutter_app/models/leave_balance/get_absence_dff_structure_list_model.dart';
|
||||
import 'package:mohem_flutter_app/models/leave_balance/get_absence_transaction_list_model.dart';
|
||||
|
||||
class LeaveBalanceApiClient {
|
||||
static final LeaveBalanceApiClient _instance = LeaveBalanceApiClient._internal();
|
||||
|
||||
LeaveBalanceApiClient._internal();
|
||||
|
||||
factory LeaveBalanceApiClient() => _instance;
|
||||
|
||||
Future<List<GetAbsenceTransactionList>> getAbsenceTransactions(int pSelectedResopID) async {
|
||||
String url = "${ApiConsts.erpRest}GET_ABSENCE_TRANSACTIONS";
|
||||
Map<String, dynamic> postParams = {"P_PAGE_LIMIT": 50, "P_PAGE_NUM": 1, "P_MENU_TYPE": "E", "P_SELECTED_RESP_ID": pSelectedResopID};
|
||||
postParams.addAll(AppState().postParamsJson);
|
||||
return await ApiClient().postJsonForObject((json) {
|
||||
GenericResponseModel? responseData = GenericResponseModel.fromJson(json);
|
||||
return responseData.getAbsenceTransactionList ?? [];
|
||||
}, url, postParams);
|
||||
}
|
||||
|
||||
Future<List<GetAbsenceAttendanceTypesList>> getAbsenceAttendanceTypes() async {
|
||||
String url = "${ApiConsts.erpRest}GET_ABSENCE_ATTENDANCE_TYPES";
|
||||
Map<String, dynamic> postParams = {};
|
||||
postParams.addAll(AppState().postParamsJson);
|
||||
return await ApiClient().postJsonForObject((json) {
|
||||
GenericResponseModel? responseData = GenericResponseModel.fromJson(json);
|
||||
return responseData.getAbsenceAttendanceTypesList ?? [];
|
||||
}, url, postParams);
|
||||
}
|
||||
|
||||
Future<List<GetAbsenceDffStructureList>> getAbsenceDffStructure(String pDescFlexContextCode, String pFunctionName, int pSelectedResopID) async {
|
||||
String url = "${ApiConsts.erpRest}GET_ABSENCE_DFF_STRUCTURE";
|
||||
Map<String, dynamic> postParams = {"P_DESC_FLEX_CONTEXT_CODE": pDescFlexContextCode, "P_FUNCTION_NAME": pFunctionName, "P_MENU_TYPE": "E", "P_SELECTED_RESP_ID": pSelectedResopID};
|
||||
postParams.addAll(AppState().postParamsJson);
|
||||
return await ApiClient().postJsonForObject((json) {
|
||||
GenericResponseModel? responseData = GenericResponseModel.fromJson(json);
|
||||
return responseData.getAbsenceDffStructureList ?? [];
|
||||
}, url, postParams);
|
||||
}
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
class GetAbsenceAttendanceTypesList {
|
||||
int? aBSENCEATTENDANCETYPEID;
|
||||
String? aBSENCEATTENDANCETYPENAME;
|
||||
String? dESCFLEXCONTEXTCODE;
|
||||
String? hOURSORDAYS;
|
||||
|
||||
GetAbsenceAttendanceTypesList({this.aBSENCEATTENDANCETYPEID, this.aBSENCEATTENDANCETYPENAME, this.dESCFLEXCONTEXTCODE, this.hOURSORDAYS});
|
||||
|
||||
GetAbsenceAttendanceTypesList.fromJson(Map<String, dynamic> json) {
|
||||
aBSENCEATTENDANCETYPEID = json['ABSENCE_ATTENDANCE_TYPE_ID'];
|
||||
aBSENCEATTENDANCETYPENAME = json['ABSENCE_ATTENDANCE_TYPE_NAME'];
|
||||
dESCFLEXCONTEXTCODE = json['DESC_FLEX_CONTEXT_CODE'];
|
||||
hOURSORDAYS = json['HOURS_OR_DAYS'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['ABSENCE_ATTENDANCE_TYPE_ID'] = this.aBSENCEATTENDANCETYPEID;
|
||||
data['ABSENCE_ATTENDANCE_TYPE_NAME'] = this.aBSENCEATTENDANCETYPENAME;
|
||||
data['DESC_FLEX_CONTEXT_CODE'] = this.dESCFLEXCONTEXTCODE;
|
||||
data['HOURS_OR_DAYS'] = this.hOURSORDAYS;
|
||||
return data;
|
||||
}
|
||||
}
|
@ -0,0 +1,193 @@
|
||||
import 'package:mohem_flutter_app/models/get_eit_dff_structure_list_model.dart';
|
||||
|
||||
class GetAbsenceDffStructureList {
|
||||
String? aLPHANUMERICALLOWEDFLAG;
|
||||
String? aPPLICATIONCOLUMNNAME;
|
||||
String? cHILDSEGMENTSDV;
|
||||
List<String>? cHILDSEGMENTSDVSplited;
|
||||
String? cHILDSEGMENTSVS;
|
||||
List<String>? cHILDSEGMENTSVSSplited;
|
||||
String? dEFAULTTYPE;
|
||||
String? dEFAULTVALUE;
|
||||
String? dESCFLEXCONTEXTCODE;
|
||||
String? dESCFLEXCONTEXTNAME;
|
||||
String? dESCFLEXNAME;
|
||||
String? dISPLAYFLAG;
|
||||
String? eNABLEDFLAG;
|
||||
ESERVICESDV? eSERVICESDV;
|
||||
List<ESERVICESVS>? eSERVICESVS;
|
||||
String? fLEXVALUESETNAME;
|
||||
String? fORMATTYPE;
|
||||
String? fORMATTYPEDSP;
|
||||
bool? isEmptyOption;
|
||||
String? lONGLISTFLAG;
|
||||
int? mAXIMUMSIZE;
|
||||
String? mAXIMUMVALUE;
|
||||
String? mINIMUMVALUE;
|
||||
String? mOBILEENABLED;
|
||||
String? nUMBERPRECISION;
|
||||
String? nUMERICMODEENABLEDFLAG;
|
||||
String? pARENTSEGMENTSDV;
|
||||
List<PARENTSEGMENTSDVSplited>? pARENTSEGMENTSDVSplited;
|
||||
String? pARENTSEGMENTSVS;
|
||||
List<PARENTSEGMENTSVSSplitedVS>? pARENTSEGMENTSVSSplitedVS;
|
||||
String? rEADONLY;
|
||||
String? rEQUIREDFLAG;
|
||||
String? sEGMENTNAME;
|
||||
String? sEGMENTPROMPT;
|
||||
int? sEGMENTSEQNUM;
|
||||
String? uPPERCASEONLYFLAG;
|
||||
String? uSEDFLAG;
|
||||
String? vALIDATIONTYPE;
|
||||
String? vALIDATIONTYPEDSP;
|
||||
|
||||
GetAbsenceDffStructureList(
|
||||
{this.aLPHANUMERICALLOWEDFLAG,
|
||||
this.aPPLICATIONCOLUMNNAME,
|
||||
this.cHILDSEGMENTSDV,
|
||||
this.cHILDSEGMENTSDVSplited,
|
||||
this.cHILDSEGMENTSVS,
|
||||
this.cHILDSEGMENTSVSSplited,
|
||||
this.dEFAULTTYPE,
|
||||
this.dEFAULTVALUE,
|
||||
this.dESCFLEXCONTEXTCODE,
|
||||
this.dESCFLEXCONTEXTNAME,
|
||||
this.dESCFLEXNAME,
|
||||
this.dISPLAYFLAG,
|
||||
this.eNABLEDFLAG,
|
||||
this.eSERVICESDV,
|
||||
this.eSERVICESVS,
|
||||
this.fLEXVALUESETNAME,
|
||||
this.fORMATTYPE,
|
||||
this.fORMATTYPEDSP,
|
||||
this.isEmptyOption,
|
||||
this.lONGLISTFLAG,
|
||||
this.mAXIMUMSIZE,
|
||||
this.mAXIMUMVALUE,
|
||||
this.mINIMUMVALUE,
|
||||
this.mOBILEENABLED,
|
||||
this.nUMBERPRECISION,
|
||||
this.nUMERICMODEENABLEDFLAG,
|
||||
this.pARENTSEGMENTSDV,
|
||||
this.pARENTSEGMENTSDVSplited,
|
||||
this.pARENTSEGMENTSVS,
|
||||
this.pARENTSEGMENTSVSSplitedVS,
|
||||
this.rEADONLY,
|
||||
this.rEQUIREDFLAG,
|
||||
this.sEGMENTNAME,
|
||||
this.sEGMENTPROMPT,
|
||||
this.sEGMENTSEQNUM,
|
||||
this.uPPERCASEONLYFLAG,
|
||||
this.uSEDFLAG,
|
||||
this.vALIDATIONTYPE,
|
||||
this.vALIDATIONTYPEDSP});
|
||||
|
||||
GetAbsenceDffStructureList.fromJson(Map<String, dynamic> json) {
|
||||
aLPHANUMERICALLOWEDFLAG = json['ALPHANUMERIC_ALLOWED_FLAG'];
|
||||
aPPLICATIONCOLUMNNAME = json['APPLICATION_COLUMN_NAME'];
|
||||
cHILDSEGMENTSDV = json['CHILD_SEGMENTS_DV'];
|
||||
cHILDSEGMENTSDVSplited = json['CHILD_SEGMENTS_DV_Splited'] == null ? <String>[] : json['CHILD_SEGMENTS_DV_Splited'].cast<String>();
|
||||
cHILDSEGMENTSVS = json['CHILD_SEGMENTS_VS'];
|
||||
cHILDSEGMENTSVSSplited = json['CHILD_SEGMENTS_VS_Splited']== null ? <String>[] : json['CHILD_SEGMENTS_VS_Splited'].cast<String>();
|
||||
dEFAULTTYPE = json['DEFAULT_TYPE'];
|
||||
dEFAULTVALUE = json['DEFAULT_VALUE'];
|
||||
dESCFLEXCONTEXTCODE = json['DESC_FLEX_CONTEXT_CODE'];
|
||||
dESCFLEXCONTEXTNAME = json['DESC_FLEX_CONTEXT_NAME'];
|
||||
dESCFLEXNAME = json['DESC_FLEX_NAME'];
|
||||
dISPLAYFLAG = json['DISPLAY_FLAG'];
|
||||
eNABLEDFLAG = json['ENABLED_FLAG'];
|
||||
eSERVICESDV = json['E_SERVICES_DV'] != null ? new ESERVICESDV.fromJson(json['E_SERVICES_DV']) : null;
|
||||
if (json['E_SERVICES_VS'] != null) {
|
||||
eSERVICESVS = <ESERVICESVS>[];
|
||||
json['E_SERVICES_VS'].forEach((v) {
|
||||
eSERVICESVS!.add(new ESERVICESVS.fromJson(v));
|
||||
});
|
||||
}
|
||||
fLEXVALUESETNAME = json['FLEX_VALUE_SET_NAME'];
|
||||
fORMATTYPE = json['FORMAT_TYPE'];
|
||||
fORMATTYPEDSP = json['FORMAT_TYPE_DSP'];
|
||||
isEmptyOption = json['IsEmptyOption'];
|
||||
lONGLISTFLAG = json['LONGLIST_FLAG'];
|
||||
mAXIMUMSIZE = json['MAXIMUM_SIZE'];
|
||||
mAXIMUMVALUE = json['MAXIMUM_VALUE'];
|
||||
mINIMUMVALUE = json['MINIMUM_VALUE'];
|
||||
mOBILEENABLED = json['MOBILE_ENABLED'];
|
||||
nUMBERPRECISION = json['NUMBER_PRECISION'];
|
||||
nUMERICMODEENABLEDFLAG = json['NUMERIC_MODE_ENABLED_FLAG'];
|
||||
pARENTSEGMENTSDV = json['PARENT_SEGMENTS_DV'];
|
||||
if (json['PARENT_SEGMENTS_DV_Splited'] != null) {
|
||||
pARENTSEGMENTSDVSplited = <PARENTSEGMENTSDVSplited>[];
|
||||
json['PARENT_SEGMENTS_DV_Splited'].forEach((v) {
|
||||
pARENTSEGMENTSDVSplited!.add(PARENTSEGMENTSDVSplited.fromJson(v));
|
||||
});
|
||||
}
|
||||
pARENTSEGMENTSVS = json['PARENT_SEGMENTS_VS'];
|
||||
if (json['PARENT_SEGMENTS_VS_SplitedVS'] != null) {
|
||||
pARENTSEGMENTSVSSplitedVS = <PARENTSEGMENTSVSSplitedVS>[];
|
||||
json['PARENT_SEGMENTS_VS_SplitedVS'].forEach((v) {
|
||||
pARENTSEGMENTSVSSplitedVS!.add(new PARENTSEGMENTSVSSplitedVS.fromJson(v));
|
||||
});
|
||||
}
|
||||
rEADONLY = json['READ_ONLY'];
|
||||
rEQUIREDFLAG = json['REQUIRED_FLAG'];
|
||||
sEGMENTNAME = json['SEGMENT_NAME'];
|
||||
sEGMENTPROMPT = json['SEGMENT_PROMPT'];
|
||||
sEGMENTSEQNUM = json['SEGMENT_SEQ_NUM'];
|
||||
uPPERCASEONLYFLAG = json['UPPERCASE_ONLY_FLAG'];
|
||||
uSEDFLAG = json['USED_FLAG'];
|
||||
vALIDATIONTYPE = json['VALIDATION_TYPE'];
|
||||
vALIDATIONTYPEDSP = json['VALIDATION_TYPE_DSP'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['ALPHANUMERIC_ALLOWED_FLAG'] = this.aLPHANUMERICALLOWEDFLAG;
|
||||
data['APPLICATION_COLUMN_NAME'] = this.aPPLICATIONCOLUMNNAME;
|
||||
data['CHILD_SEGMENTS_DV'] = this.cHILDSEGMENTSDV;
|
||||
data['CHILD_SEGMENTS_DV_Splited'] = this.cHILDSEGMENTSDVSplited;
|
||||
data['CHILD_SEGMENTS_VS'] = this.cHILDSEGMENTSVS;
|
||||
data['CHILD_SEGMENTS_VS_Splited'] = this.cHILDSEGMENTSVSSplited;
|
||||
data['DEFAULT_TYPE'] = this.dEFAULTTYPE;
|
||||
data['DEFAULT_VALUE'] = this.dEFAULTVALUE;
|
||||
data['DESC_FLEX_CONTEXT_CODE'] = this.dESCFLEXCONTEXTCODE;
|
||||
data['DESC_FLEX_CONTEXT_NAME'] = this.dESCFLEXCONTEXTNAME;
|
||||
data['DESC_FLEX_NAME'] = this.dESCFLEXNAME;
|
||||
data['DISPLAY_FLAG'] = this.dISPLAYFLAG;
|
||||
data['ENABLED_FLAG'] = this.eNABLEDFLAG;
|
||||
if (this.eSERVICESDV != null) {
|
||||
data['E_SERVICES_DV'] = this.eSERVICESDV!.toJson();
|
||||
}
|
||||
if (this.eSERVICESVS != null) {
|
||||
data['E_SERVICES_VS'] = this.eSERVICESVS!.map((v) => v.toJson()).toList();
|
||||
}
|
||||
data['FLEX_VALUE_SET_NAME'] = this.fLEXVALUESETNAME;
|
||||
data['FORMAT_TYPE'] = this.fORMATTYPE;
|
||||
data['FORMAT_TYPE_DSP'] = this.fORMATTYPEDSP;
|
||||
data['IsEmptyOption'] = this.isEmptyOption;
|
||||
data['LONGLIST_FLAG'] = this.lONGLISTFLAG;
|
||||
data['MAXIMUM_SIZE'] = this.mAXIMUMSIZE;
|
||||
data['MAXIMUM_VALUE'] = this.mAXIMUMVALUE;
|
||||
data['MINIMUM_VALUE'] = this.mINIMUMVALUE;
|
||||
data['MOBILE_ENABLED'] = this.mOBILEENABLED;
|
||||
data['NUMBER_PRECISION'] = this.nUMBERPRECISION;
|
||||
data['NUMERIC_MODE_ENABLED_FLAG'] = this.nUMERICMODEENABLEDFLAG;
|
||||
data['PARENT_SEGMENTS_DV'] = this.pARENTSEGMENTSDV;
|
||||
if (this.pARENTSEGMENTSDVSplited != null) {
|
||||
data['PARENT_SEGMENTS_DV_Splited'] = this.pARENTSEGMENTSDVSplited!.map((v) => v.toJson()).toList();
|
||||
}
|
||||
data['PARENT_SEGMENTS_VS'] = this.pARENTSEGMENTSVS;
|
||||
if (this.pARENTSEGMENTSVSSplitedVS != null) {
|
||||
data['PARENT_SEGMENTS_VS_SplitedVS'] = this.pARENTSEGMENTSVSSplitedVS!.map((v) => v.toJson()).toList();
|
||||
}
|
||||
data['READ_ONLY'] = this.rEADONLY;
|
||||
data['REQUIRED_FLAG'] = this.rEQUIREDFLAG;
|
||||
data['SEGMENT_NAME'] = this.sEGMENTNAME;
|
||||
data['SEGMENT_PROMPT'] = this.sEGMENTPROMPT;
|
||||
data['SEGMENT_SEQ_NUM'] = this.sEGMENTSEQNUM;
|
||||
data['UPPERCASE_ONLY_FLAG'] = this.uPPERCASEONLYFLAG;
|
||||
data['USED_FLAG'] = this.uSEDFLAG;
|
||||
data['VALIDATION_TYPE'] = this.vALIDATIONTYPE;
|
||||
data['VALIDATION_TYPE_DSP'] = this.vALIDATIONTYPEDSP;
|
||||
return data;
|
||||
}
|
||||
}
|
@ -0,0 +1,82 @@
|
||||
class GetAbsenceTransactionList {
|
||||
int? aBSENCEATTENDANCEID;
|
||||
int? aBSENCEATTENDANCETYPEID;
|
||||
String? aBSENCECATEGORY;
|
||||
double? aBSENCEDAYS;
|
||||
double? aBSENCEHOURS;
|
||||
String? aBSENCESTATUS;
|
||||
String? aBSENCETYPE;
|
||||
String? aPPROVALSTATUS;
|
||||
String? aTTACHMENTEXIST;
|
||||
String? dELETEBUTTON;
|
||||
String? eNDDATE;
|
||||
int? fROMROWNUM;
|
||||
int? nOOFROWS;
|
||||
int? rOWNUM;
|
||||
String? sTARTDATE;
|
||||
int? tOROWNUM;
|
||||
String? uPDATEBUTTON;
|
||||
|
||||
GetAbsenceTransactionList(
|
||||
{this.aBSENCEATTENDANCEID,
|
||||
this.aBSENCEATTENDANCETYPEID,
|
||||
this.aBSENCECATEGORY,
|
||||
this.aBSENCEDAYS,
|
||||
this.aBSENCEHOURS,
|
||||
this.aBSENCESTATUS,
|
||||
this.aBSENCETYPE,
|
||||
this.aPPROVALSTATUS,
|
||||
this.aTTACHMENTEXIST,
|
||||
this.dELETEBUTTON,
|
||||
this.eNDDATE,
|
||||
this.fROMROWNUM,
|
||||
this.nOOFROWS,
|
||||
this.rOWNUM,
|
||||
this.sTARTDATE,
|
||||
this.tOROWNUM,
|
||||
this.uPDATEBUTTON});
|
||||
|
||||
GetAbsenceTransactionList.fromJson(Map<String, dynamic> json) {
|
||||
print("json:$json");
|
||||
print("type:ABSENCE_DAYS:${(json['ABSENCE_DAYS']).runtimeType}");
|
||||
aBSENCEATTENDANCEID = json['ABSENCE_ATTENDANCE_ID'];
|
||||
aBSENCEATTENDANCETYPEID = json['ABSENCE_ATTENDANCE_TYPE_ID'];
|
||||
aBSENCECATEGORY = json['ABSENCE_CATEGORY'];
|
||||
aBSENCEDAYS = double.parse(json['ABSENCE_DAYS'].toString() ?? "0.0");
|
||||
aBSENCEHOURS = json['ABSENCE_HOURS'];
|
||||
aBSENCESTATUS = json['ABSENCE_STATUS'];
|
||||
aBSENCETYPE = json['ABSENCE_TYPE'];
|
||||
aPPROVALSTATUS = json['APPROVAL_STATUS'];
|
||||
aTTACHMENTEXIST = json['ATTACHMENT_EXIST'];
|
||||
dELETEBUTTON = json['DELETE_BUTTON'];
|
||||
eNDDATE = json['END_DATE'];
|
||||
fROMROWNUM = json['FROM_ROW_NUM'];
|
||||
nOOFROWS = json['NO_OF_ROWS'];
|
||||
rOWNUM = json['ROW_NUM'];
|
||||
sTARTDATE = json['START_DATE'];
|
||||
tOROWNUM = json['TO_ROW_NUM'];
|
||||
uPDATEBUTTON = json['UPDATE_BUTTON'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['ABSENCE_ATTENDANCE_ID'] = this.aBSENCEATTENDANCEID;
|
||||
data['ABSENCE_ATTENDANCE_TYPE_ID'] = this.aBSENCEATTENDANCETYPEID;
|
||||
data['ABSENCE_CATEGORY'] = this.aBSENCECATEGORY;
|
||||
data['ABSENCE_DAYS'] = this.aBSENCEDAYS;
|
||||
data['ABSENCE_HOURS'] = this.aBSENCEHOURS;
|
||||
data['ABSENCE_STATUS'] = this.aBSENCESTATUS;
|
||||
data['ABSENCE_TYPE'] = this.aBSENCETYPE;
|
||||
data['APPROVAL_STATUS'] = this.aPPROVALSTATUS;
|
||||
data['ATTACHMENT_EXIST'] = this.aTTACHMENTEXIST;
|
||||
data['DELETE_BUTTON'] = this.dELETEBUTTON;
|
||||
data['END_DATE'] = this.eNDDATE;
|
||||
data['FROM_ROW_NUM'] = this.fROMROWNUM;
|
||||
data['NO_OF_ROWS'] = this.nOOFROWS;
|
||||
data['ROW_NUM'] = this.rOWNUM;
|
||||
data['START_DATE'] = this.sTARTDATE;
|
||||
data['TO_ROW_NUM'] = this.tOROWNUM;
|
||||
data['UPDATE_BUTTON'] = this.uPDATEBUTTON;
|
||||
return data;
|
||||
}
|
||||
}
|
@ -0,0 +1,502 @@
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:easy_localization/easy_localization.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/classes/utils.dart';
|
||||
import 'package:mohem_flutter_app/extensions/int_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/leave_balance/get_absence_attendance_types_list_model.dart';
|
||||
import 'package:mohem_flutter_app/models/leave_balance/get_absence_dff_structure_list_model.dart';
|
||||
import 'package:mohem_flutter_app/models/worklist/replacement_list_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/search_employee_bottom_sheet.dart';
|
||||
import 'package:mohem_flutter_app/widgets/button/default_button.dart';
|
||||
import 'package:mohem_flutter_app/widgets/dynamic_forms/dynamic_textfield_widget.dart';
|
||||
|
||||
class AddLeaveBalanceScreen extends StatefulWidget {
|
||||
AddLeaveBalanceScreen({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
_AddLeaveBalanceScreenState createState() {
|
||||
return _AddLeaveBalanceScreenState();
|
||||
}
|
||||
}
|
||||
|
||||
class _AddLeaveBalanceScreenState extends State<AddLeaveBalanceScreen> {
|
||||
List<GetAbsenceDffStructureList> getabsenceDffStructureList = [];
|
||||
List<GetAbsenceAttendanceTypesList> absenceList = [];
|
||||
|
||||
GetAbsenceAttendanceTypesList? selectedAbsenceType;
|
||||
DateTime? startTime;
|
||||
DateTime? endTime;
|
||||
int totalDays = 0;
|
||||
String comment = "";
|
||||
ReplacementList? selectedReplacementEmployee;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
getAbsenceAttendanceTypes();
|
||||
}
|
||||
|
||||
void getAbsenceAttendanceTypes() async {
|
||||
try {
|
||||
Utils.showLoading(context);
|
||||
absenceList = await LeaveBalanceApiClient().getAbsenceAttendanceTypes();
|
||||
Utils.hideLoading(context);
|
||||
setState(() {});
|
||||
} catch (ex) {
|
||||
Utils.hideLoading(context);
|
||||
Utils.handleException(ex, context, null);
|
||||
}
|
||||
}
|
||||
|
||||
void getAbsenceDffStructure(String flexCode) async {
|
||||
try {
|
||||
Utils.showLoading(context);
|
||||
getabsenceDffStructureList.clear();
|
||||
getabsenceDffStructureList = await LeaveBalanceApiClient().getAbsenceDffStructure(flexCode, "HR_LOA_SS", -999);
|
||||
Utils.hideLoading(context);
|
||||
setState(() {});
|
||||
} catch (ex) {
|
||||
Utils.hideLoading(context);
|
||||
Utils.handleException(ex, context, null);
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
backgroundColor: Colors.white,
|
||||
appBar: AppBarWidget(
|
||||
context,
|
||||
title: LocaleKeys.leaveBalance.tr(),
|
||||
),
|
||||
body: Column(
|
||||
children: [
|
||||
ListView(
|
||||
padding: const EdgeInsets.all(21),
|
||||
children: [
|
||||
PopupMenuButton(
|
||||
child: DynamicTextFieldWidget(
|
||||
LocaleKeys.absenceType.tr() + "*",
|
||||
selectedAbsenceType == null ? LocaleKeys.selectTypeT.tr() : selectedAbsenceType!.aBSENCEATTENDANCETYPENAME!,
|
||||
isEnable: false,
|
||||
isPopup: true,
|
||||
),
|
||||
itemBuilder: (_) => <PopupMenuItem<int>>[
|
||||
for (int i = 0; i < absenceList.length; i++) PopupMenuItem<int>(value: i, child: Text(absenceList[i].aBSENCEATTENDANCETYPENAME!)),
|
||||
],
|
||||
onSelected: (int popupIndex) {
|
||||
if (selectedAbsenceType == absenceList[popupIndex]) {
|
||||
return;
|
||||
}
|
||||
selectedAbsenceType = absenceList[popupIndex];
|
||||
setState(() {});
|
||||
getAbsenceDffStructure(selectedAbsenceType!.dESCFLEXCONTEXTCODE!);
|
||||
},
|
||||
),
|
||||
12.height,
|
||||
DynamicTextFieldWidget(
|
||||
LocaleKeys.startDateT.tr() + "*",
|
||||
startTime == null ? "Select date" : startTime.toString(),
|
||||
suffixIconData: Icons.calendar_today,
|
||||
isEnable: false,
|
||||
onTap: () async {
|
||||
var start = await _selectDate(context, startTime);
|
||||
if (start != startTime) {
|
||||
startTime = start;
|
||||
setState(() {});
|
||||
}
|
||||
},
|
||||
),
|
||||
12.height,
|
||||
DynamicTextFieldWidget(
|
||||
LocaleKeys.endDateT.tr() + "*",
|
||||
endTime == null ? "Select date" : endTime.toString(),
|
||||
suffixIconData: Icons.calendar_today,
|
||||
isEnable: false,
|
||||
onTap: () async {
|
||||
var end = await _selectDate(context, endTime);
|
||||
if (end != endTime) {
|
||||
endTime = end;
|
||||
setState(() {});
|
||||
}
|
||||
},
|
||||
),
|
||||
12.height,
|
||||
DynamicTextFieldWidget(
|
||||
"Total Days",
|
||||
"Days",
|
||||
isInputTypeNum: true,
|
||||
onChange: (input) {
|
||||
totalDays = int.parse(input);
|
||||
},
|
||||
),
|
||||
12.height,
|
||||
DynamicTextFieldWidget(
|
||||
LocaleKeys.selectEmployee.tr(),
|
||||
selectedReplacementEmployee == null ? LocaleKeys.searchForEmployee.tr() : selectedReplacementEmployee!.employeeDisplayName ?? "",
|
||||
isEnable: false,
|
||||
onTap: () {
|
||||
showMyBottomSheet(
|
||||
context,
|
||||
child: SearchEmployeeBottomSheet(
|
||||
title: LocaleKeys.searchForEmployee.tr(),
|
||||
apiMode: LocaleKeys.delegate.tr(),
|
||||
onSelectEmployee: (_selectedEmployee) {
|
||||
// Navigator.pop(context);
|
||||
selectedReplacementEmployee = _selectedEmployee;
|
||||
setState(() {});
|
||||
},
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
12.height,
|
||||
DynamicTextFieldWidget(
|
||||
LocaleKeys.comments.tr(),
|
||||
LocaleKeys.writeComment.tr(),
|
||||
lines: 2,
|
||||
onChange: (input) {
|
||||
comment = input;
|
||||
},
|
||||
),
|
||||
],
|
||||
).expanded,
|
||||
DefaultButton(
|
||||
LocaleKeys.next.tr(),
|
||||
(selectedAbsenceType == null || startTime == null || endTime == null) ? null : () {},
|
||||
).insideContainer
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
// Widget parseDynamicFormatType(GetAbsenceDffStructureList model, int index) {
|
||||
// if (model.dISPLAYFLAG != "N") {
|
||||
// if (model.vALIDATIONTYPE == "N") {
|
||||
// if (model.fORMATTYPE == "C") {
|
||||
// return DynamicTextFieldWidget(
|
||||
// (model.sEGMENTPROMPT ?? "") + (model.rEQUIREDFLAG == "Y" ? "*" : ""),
|
||||
// model.eSERVICESDV?.pIDCOLUMNNAME ?? "",
|
||||
// isReadOnly: model.rEADONLY == "Y",
|
||||
// onChange: (text) {
|
||||
// model.eSERVICESDV ??= ESERVICESDV();
|
||||
// model.eSERVICESDV!.pIDCOLUMNNAME = text;
|
||||
// },
|
||||
// ).paddingOnly(bottom: 12);
|
||||
// } else if (model.fORMATTYPE == "N") {
|
||||
// return DynamicTextFieldWidget(
|
||||
// (model.sEGMENTPROMPT ?? "") + (model.rEQUIREDFLAG == "Y" ? "*" : ""),
|
||||
// model.eSERVICESDV?.pIDCOLUMNNAME ?? "",
|
||||
// isReadOnly: model.rEADONLY == "Y",
|
||||
// isInputTypeNum: true,
|
||||
// onChange: (text) {
|
||||
// model.eSERVICESDV ??= ESERVICESDV();
|
||||
// model.eSERVICESDV!.pIDCOLUMNNAME = text;
|
||||
// },
|
||||
// ).paddingOnly(bottom: 12);
|
||||
// } else if (model.fORMATTYPE == "X") {
|
||||
// String displayText = model.eSERVICESDV?.pIDCOLUMNNAME ?? (getabsenceDffStructureList![index].fieldAnswer ?? "");
|
||||
//
|
||||
// if (getabsenceDffStructureList[index].isDefaultTypeIsCDPS) {
|
||||
// if (displayText.contains(" 00:00:00")) {
|
||||
// displayText = displayText.replaceAll(" 00:00:00", "");
|
||||
// }
|
||||
// if (displayText.contains("/")) {
|
||||
// displayText = DateFormat('yyyy-MM-dd').format(DateFormat("yyyy/MM/dd").parse(displayText));
|
||||
// }
|
||||
// }
|
||||
// return DynamicTextFieldWidget(
|
||||
// (model.sEGMENTPROMPT ?? "") + (model.rEQUIREDFLAG == "Y" ? "*" : ""),
|
||||
// displayText,
|
||||
// suffixIconData: Icons.calendar_today,
|
||||
// isEnable: false,
|
||||
// onTap: () async {
|
||||
// if ((getabsenceDffStructureList![index].eSERVICESDV?.pVALUECOLUMNNAME != null)) {
|
||||
// if (getabsenceDffStructureList![index].isDefaultTypeIsCDPS) {
|
||||
// selectedDate = DateFormat("yyyy/MM/dd").parse(getabsenceDffStructureList![index].eSERVICESDV!.pVALUECOLUMNNAME!.replaceAll('/"', '').replaceAll(" 00:00:00", ""));
|
||||
// } else {
|
||||
// selectedDate = DateTime.parse(getabsenceDffStructureList![index].eSERVICESDV!.pVALUECOLUMNNAME!);
|
||||
// }
|
||||
// }
|
||||
// DateTime date = await _selectDate(context);
|
||||
// String dateString = date.toString().split(' ').first;
|
||||
// // DateTime date1 = DateTime(date.year, date.month, date.day);
|
||||
// // getabsenceDffStructureList![index].fieldAnswer = date.toString();
|
||||
// ESERVICESDV eservicesdv;
|
||||
// if (getabsenceDffStructureList![index].isDefaultTypeIsCDPS) {
|
||||
// eservicesdv = ESERVICESDV(
|
||||
// pIDCOLUMNNAME: formatDate(dateString),
|
||||
// pRETURNMSG: "null",
|
||||
// pRETURNSTATUS: getabsenceDffStructureList![index].dEFAULTVALUE,
|
||||
// pVALUECOLUMNNAME: getabsenceDffStructureList![index].isDefaultTypeIsCDPS ? reverseFormatStandardDate(formatDate(dateString)) : DateFormat('yyyy-MM-ddThh:mm:ss.s').format(date));
|
||||
// } else {
|
||||
// eservicesdv = ESERVICESDV(
|
||||
// pIDCOLUMNNAME: dateString,
|
||||
// pRETURNMSG: "null",
|
||||
// pRETURNSTATUS: getabsenceDffStructureList![index].dEFAULTVALUE,
|
||||
// pVALUECOLUMNNAME: getabsenceDffStructureList![index].isDefaultTypeIsCDPS ? reverseFormatStandardDate(formatDate(dateString)) : DateFormat('yyyy-MM-ddThh:mm:ss.s').format(date));
|
||||
// }
|
||||
// getabsenceDffStructureList![index].eSERVICESDV = eservicesdv;
|
||||
// setState(() {});
|
||||
// if (model.cHILDSEGMENTSVSSplited?.isNotEmpty ?? false) {
|
||||
// await calGetValueSetValues(model);
|
||||
// }
|
||||
// if (model.cHILDSEGMENTSDVSplited?.isNotEmpty ?? false) {
|
||||
// await getDefaultValues(model);
|
||||
// }
|
||||
// },
|
||||
// ).paddingOnly(bottom: 12);
|
||||
// } else if (model.fORMATTYPE == "Y") {
|
||||
// String displayText = model.eSERVICESDV?.pIDCOLUMNNAME ?? (getabsenceDffStructureList![index].fieldAnswer ?? "");
|
||||
// if (getabsenceDffStructureList![index].isDefaultTypeIsCDPS) {
|
||||
// displayText = reverseFormatDate(displayText);
|
||||
// // if (displayText.contains(" 00:00:00")) {
|
||||
// // displayText = displayText.replaceAll(" 00:00:00", "");
|
||||
// // }
|
||||
// // if (!displayText.contains("-")) {
|
||||
// // displayText = DateFormat('yyyy-MM-dd').format(DateFormat("yyyy/MM/dd").parse(displayText));
|
||||
// // }
|
||||
// }
|
||||
// return DynamicTextFieldWidget(
|
||||
// (model.sEGMENTPROMPT ?? "") + (model.rEQUIREDFLAG == "Y" ? "*" : ""),
|
||||
// displayText,
|
||||
// suffixIconData: Icons.calendar_today,
|
||||
// isEnable: false,
|
||||
// onTap: () async {
|
||||
// if ((getabsenceDffStructureList![index].eSERVICESDV?.pVALUECOLUMNNAME != null)) {
|
||||
// if (getabsenceDffStructureList![index].isDefaultTypeIsCDPS) {
|
||||
// String tempDate = getabsenceDffStructureList![index].eSERVICESDV!.pVALUECOLUMNNAME!;
|
||||
// if (tempDate.contains("00:00:00")) {
|
||||
// tempDate = tempDate.replaceAll("00:00:00", '').trim();
|
||||
// }
|
||||
// if (tempDate.contains("/")) {
|
||||
// selectedDate = DateFormat("yyyy/MM/dd").parse(tempDate);
|
||||
// } else {
|
||||
// selectedDate = DateFormat("yyyy-MM-dd").parse(tempDate);
|
||||
// }
|
||||
// } else {
|
||||
// selectedDate = DateTime.parse(getabsenceDffStructureList![index].eSERVICESDV!.pVALUECOLUMNNAME!);
|
||||
// }
|
||||
// }
|
||||
// DateTime date = await _selectDate(context);
|
||||
// String dateString = date.toString().split(' ').first;
|
||||
// // getabsenceDffStructureList![index].fieldAnswer = date.toString();
|
||||
// ESERVICESDV eservicesdv;
|
||||
// if (getabsenceDffStructureList![index].isDefaultTypeIsCDPS) {
|
||||
// eservicesdv = ESERVICESDV(
|
||||
// pIDCOLUMNNAME: formatDate(dateString),
|
||||
// pRETURNMSG: "null",
|
||||
// pRETURNSTATUS: getabsenceDffStructureList![index].dEFAULTVALUE,
|
||||
// pVALUECOLUMNNAME: getabsenceDffStructureList![index].isDefaultTypeIsCDPS ? reverseFormatStandardDate(formatDate(dateString)) : DateFormat('yyyy-MM-ddThh:mm:ss.s').format(date));
|
||||
// } else {
|
||||
// eservicesdv = ESERVICESDV(
|
||||
// pIDCOLUMNNAME: dateString,
|
||||
// pRETURNMSG: "null",
|
||||
// pRETURNSTATUS: getabsenceDffStructureList![index].dEFAULTVALUE,
|
||||
// pVALUECOLUMNNAME: getabsenceDffStructureList![index].isDefaultTypeIsCDPS ? reverseFormatStandardDate(formatDate(dateString)) : DateFormat('yyyy-MM-ddThh:mm:ss.s').format(date));
|
||||
// }
|
||||
//
|
||||
// getabsenceDffStructureList![index].eSERVICESDV = eservicesdv;
|
||||
// setState(() {});
|
||||
// if (model.cHILDSEGMENTSVSSplited?.isNotEmpty ?? false) {
|
||||
// await calGetValueSetValues(model);
|
||||
// }
|
||||
// if (model.cHILDSEGMENTSDVSplited?.isNotEmpty ?? false) {
|
||||
// await getDefaultValues(model);
|
||||
// }
|
||||
// },
|
||||
// ).paddingOnly(bottom: 12);
|
||||
// }
|
||||
// } else {
|
||||
// return PopupMenuButton(
|
||||
// child: DynamicTextFieldWidget(
|
||||
// (model.sEGMENTPROMPT ?? "") + (model.rEQUIREDFLAG == "Y" ? "*" : ""),
|
||||
// model.eSERVICESDV?.pVALUECOLUMNNAME ?? "",
|
||||
// isEnable: false,
|
||||
// isPopup: true,
|
||||
// isInputTypeNum: true,
|
||||
// isReadOnly: model.rEADONLY == "Y",
|
||||
// ).paddingOnly(bottom: 12),
|
||||
// itemBuilder: (_) => <PopupMenuItem<int>>[
|
||||
// if (model.rEADONLY != "Y")
|
||||
// for (int i = 0; i < model.eSERVICESVS!.length; i++) PopupMenuItem<int>(child: Text(model.eSERVICESVS![i].vALUECOLUMNNAME!), value: i),
|
||||
// ],
|
||||
// onSelected: (int popipIndex) async {
|
||||
// ESERVICESDV eservicesdv = ESERVICESDV(
|
||||
// pIDCOLUMNNAME: model.eSERVICESVS![popipIndex].iDCOLUMNNAME,
|
||||
// pRETURNMSG: "null",
|
||||
// pRETURNSTATUS: "null", //getabsenceDffStructureList![popipIndex].dEFAULTVALUE,
|
||||
// pVALUECOLUMNNAME: model.eSERVICESVS![popipIndex].vALUECOLUMNNAME);
|
||||
// getabsenceDffStructureList![index].eSERVICESDV = eservicesdv;
|
||||
// setState(() {});
|
||||
// if (model.cHILDSEGMENTSVSSplited?.isNotEmpty ?? false) {
|
||||
// await calGetValueSetValues(model);
|
||||
// }
|
||||
// if (model.cHILDSEGMENTSDVSplited?.isNotEmpty ?? false) {
|
||||
// await getDefaultValues(model);
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
// } else {
|
||||
// return const SizedBox();
|
||||
// }
|
||||
// if (model.fORMATTYPE == "N") {
|
||||
// if (model.eSERVICESVS?.isNotEmpty ?? false) {
|
||||
// return PopupMenuButton(
|
||||
// child: DynamicTextFieldWidget(
|
||||
// (model.sEGMENTPROMPT ?? "") + (model.rEQUIREDFLAG == "Y" ? "*" : ""),
|
||||
// model.eSERVICESDV?.pVALUECOLUMNNAME ?? "",
|
||||
// isEnable: false,
|
||||
// isPopup: true,
|
||||
// isInputTypeNum: true,
|
||||
// isReadOnly: model.rEADONLY == "Y",
|
||||
// ).paddingOnly(bottom: 12),
|
||||
// itemBuilder: (_) => <PopupMenuItem<int>>[
|
||||
// if (model.rEADONLY != "Y")
|
||||
// for (int i = 0; i < model.eSERVICESVS!.length; i++) PopupMenuItem<int>(value: i, child: Text(model.eSERVICESVS![i].vALUECOLUMNNAME!)),
|
||||
// ],
|
||||
// onSelected: (int popipIndex) async {
|
||||
// ESERVICESDV eservicesdv =
|
||||
// ESERVICESDV(pIDCOLUMNNAME: model.eSERVICESVS![popipIndex].iDCOLUMNNAME, pRETURNMSG: "null", pRETURNSTATUS: "null", pVALUECOLUMNNAME: model.eSERVICESVS![popipIndex].vALUECOLUMNNAME);
|
||||
// getabsenceDffStructureList![index].eSERVICESDV = eservicesdv;
|
||||
// setState(() {});
|
||||
// if (model.cHILDSEGMENTSVSSplited?.isNotEmpty ?? false) {
|
||||
// await calGetValueSetValues(model);
|
||||
// }
|
||||
// if (model.cHILDSEGMENTSDVSplited?.isNotEmpty ?? false) {
|
||||
// await getDefaultValues(model);
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
//
|
||||
// return DynamicTextFieldWidget(
|
||||
// (model.sEGMENTPROMPT ?? "") + (model.rEQUIREDFLAG == "Y" ? "*" : ""),
|
||||
// model.eSERVICESDV?.pIDCOLUMNNAME ?? "",
|
||||
// isReadOnly: model.rEADONLY == "Y",
|
||||
// onChange: (text) {
|
||||
// model.fieldAnswer = text;
|
||||
// },
|
||||
// ).paddingOnly(bottom: 12);
|
||||
// } else if (model.fORMATTYPE == "X" || model.fORMATTYPE == "Y") {
|
||||
// String displayText = model.eSERVICESDV?.pIDCOLUMNNAME ?? (getabsenceDffStructureList![index].fieldAnswer ?? "");
|
||||
// if (getabsenceDffStructureList![index].isDefaultTypeIsCDPS) {
|
||||
// if (displayText.contains(" 00:00:00")) {
|
||||
// displayText = displayText.replaceAll(" 00:00:00", "");
|
||||
// }
|
||||
// if (!displayText.contains("-")) {
|
||||
// displayText = DateFormat('yyyy-MM-dd').format(DateFormat("yyyy/MM/dd").parse(displayText));
|
||||
// }
|
||||
// }
|
||||
// return DynamicTextFieldWidget(
|
||||
// (model.sEGMENTPROMPT ?? "") + (model.rEQUIREDFLAG == "Y" ? "*" : ""),
|
||||
// displayText,
|
||||
// suffixIconData: Icons.calendar_today,
|
||||
// isEnable: false,
|
||||
// onTap: () async {
|
||||
// if ((getabsenceDffStructureList![index].eSERVICESDV?.pVALUECOLUMNNAME != null)) {
|
||||
// if (getabsenceDffStructureList![index].isDefaultTypeIsCDPS) {
|
||||
// selectedDate = DateFormat("yyyy/MM/dd").parse(getabsenceDffStructureList![index].eSERVICESDV!.pVALUECOLUMNNAME!.replaceAll('/"', '').replaceAll(" 00:00:00", ""));
|
||||
// } else {
|
||||
// selectedDate = DateTime.parse(getabsenceDffStructureList![index].eSERVICESDV!.pVALUECOLUMNNAME!);
|
||||
// }
|
||||
// }
|
||||
// DateTime date = await _selectDate(context);
|
||||
// String dateString = date.toString().split(' ').first;
|
||||
// getabsenceDffStructureList![index].fieldAnswer = date.toString();
|
||||
// ESERVICESDV eservicesdv = ESERVICESDV(
|
||||
// pIDCOLUMNNAME: dateString,
|
||||
// pRETURNMSG: "null",
|
||||
// pRETURNSTATUS: getabsenceDffStructureList![index].dEFAULTVALUE,
|
||||
// pVALUECOLUMNNAME: getabsenceDffStructureList![index].isDefaultTypeIsCDPS ? reverseFormatStandardDate(formatDate(dateString)) : DateFormat('yyyy-MM-ddThh:mm:ss.s').format(date));
|
||||
// getabsenceDffStructureList![index].eSERVICESDV = eservicesdv;
|
||||
// setState(() {});
|
||||
// if (model.cHILDSEGMENTSVSSplited?.isNotEmpty ?? false) {
|
||||
// await calGetValueSetValues(model);
|
||||
// }
|
||||
// if (model.cHILDSEGMENTSDVSplited?.isNotEmpty ?? false) {
|
||||
// await getDefaultValues(model);
|
||||
// }
|
||||
// },
|
||||
// ).paddingOnly(bottom: 12);
|
||||
// } else if (model.fORMATTYPE == "I") {
|
||||
// return DynamicTextFieldWidget(
|
||||
// (model.sEGMENTPROMPT ?? "") + (model.rEQUIREDFLAG == "Y" ? "*" : ""),
|
||||
// model.eSERVICESDV?.pIDCOLUMNNAME ?? (getabsenceDffStructureList![index].fieldAnswer ?? ""),
|
||||
// suffixIconData: Icons.access_time_filled_rounded,
|
||||
// isEnable: false,
|
||||
// onTap: () async {
|
||||
// if ((getabsenceDffStructureList![index].eSERVICESDV?.pVALUECOLUMNNAME != null)) {
|
||||
// var timeString = getabsenceDffStructureList![index].eSERVICESDV!.pVALUECOLUMNNAME!.split(":");
|
||||
// selectedDate = DateTime(0, 0, 0, int.parse(timeString[0]), int.parse(timeString[1]));
|
||||
//
|
||||
// //DateTime.parse(getabsenceDffStructureList![index].eSERVICESDV!.pVALUECOLUMNNAME!);
|
||||
// }
|
||||
// TimeOfDay _time = await _selectTime(context);
|
||||
// DateTime tempTime = DateTime(0, 1, 1, _time.hour, _time.minute);
|
||||
// String time = DateFormat('HH:mm').format(tempTime).trim();
|
||||
//
|
||||
// // DateTime date1 = DateTime(date.year, date.month, date.day);
|
||||
// // getabsenceDffStructureList![index].fieldAnswer = date.toString();
|
||||
// ESERVICESDV eservicesdv = ESERVICESDV(pIDCOLUMNNAME: time, pRETURNMSG: "null", pRETURNSTATUS: getabsenceDffStructureList![index].dEFAULTVALUE, pVALUECOLUMNNAME: time);
|
||||
// getabsenceDffStructureList![index].eSERVICESDV = eservicesdv;
|
||||
// setState(() {});
|
||||
// // if (model.cHILDSEGMENTSVSSplited?.isNotEmpty ?? false) {
|
||||
// // await calGetValueSetValues(model);
|
||||
// // }
|
||||
// // if (model.cHILDSEGMENTSDVSplited?.isNotEmpty ?? false) {
|
||||
// // await getDefaultValues(model);
|
||||
// // }
|
||||
// },
|
||||
// ).paddingOnly(bottom: 12);
|
||||
// }
|
||||
//
|
||||
// return Column(
|
||||
// crossAxisAlignment: CrossAxisAlignment.start,
|
||||
// mainAxisSize: MainAxisSize.min,
|
||||
// children: [],
|
||||
// ).objectContainerView();
|
||||
// }
|
||||
|
||||
Future<DateTime> _selectDate(BuildContext context, DateTime? dateInput) async {
|
||||
DateTime time = dateInput ?? DateTime.now();
|
||||
if (Platform.isIOS) {
|
||||
await showCupertinoModalPopup(
|
||||
context: context,
|
||||
builder: (cxt) => Container(
|
||||
height: 250,
|
||||
color: Colors.white,
|
||||
child: CupertinoDatePicker(
|
||||
backgroundColor: Colors.white,
|
||||
mode: CupertinoDatePickerMode.date,
|
||||
onDateTimeChanged: (value) {
|
||||
if (value != dateInput) {
|
||||
time = value;
|
||||
}
|
||||
},
|
||||
initialDateTime: dateInput,
|
||||
),
|
||||
),
|
||||
);
|
||||
} else {
|
||||
DateTime? picked =
|
||||
await showDatePicker(context: context, initialDate: dateInput ?? DateTime.now(), initialEntryMode: DatePickerEntryMode.calendarOnly, firstDate: DateTime(2015, 8), lastDate: DateTime(2101));
|
||||
if (picked != null && picked != dateInput) {
|
||||
time = picked;
|
||||
}
|
||||
}
|
||||
time = DateTime(time.year, time.month, time.day);
|
||||
return time;
|
||||
}
|
||||
}
|
@ -0,0 +1,96 @@
|
||||
import 'package:easy_localization/easy_localization.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:mohem_flutter_app/api/leave_balance_api_client.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/widget_extensions.dart';
|
||||
import 'package:mohem_flutter_app/generated/locale_keys.g.dart';
|
||||
import 'package:mohem_flutter_app/models/leave_balance/get_absence_transaction_list_model.dart';
|
||||
import 'package:mohem_flutter_app/widgets/app_bar_widget.dart';
|
||||
import 'package:mohem_flutter_app/widgets/item_detail_view_widget.dart';
|
||||
|
||||
class LeaveBalance extends StatefulWidget {
|
||||
LeaveBalance({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
_LeaveBalanceState createState() {
|
||||
return _LeaveBalanceState();
|
||||
}
|
||||
}
|
||||
|
||||
class _LeaveBalanceState extends State<LeaveBalance> {
|
||||
List<GetAbsenceTransactionList>? absenceTransList;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
getAbsenceTransactions();
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
void getAbsenceTransactions() async {
|
||||
// try {
|
||||
Utils.showLoading(context);
|
||||
absenceTransList = await LeaveBalanceApiClient().getAbsenceTransactions(-999);
|
||||
Utils.hideLoading(context);
|
||||
setState(() {});
|
||||
// } catch (ex) {
|
||||
// Utils.hideLoading(context);
|
||||
// Utils.handleException(ex, context, null);
|
||||
// }
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
backgroundColor: Colors.white,
|
||||
appBar: AppBarWidget(
|
||||
context,
|
||||
title: LocaleKeys.leaveBalance.tr(),
|
||||
),
|
||||
body: absenceTransList == null
|
||||
? const SizedBox()
|
||||
: (absenceTransList!.isEmpty
|
||||
? Utils.getNoDataWidget(context)
|
||||
: ListView.separated(
|
||||
physics: const BouncingScrollPhysics(),
|
||||
padding: const EdgeInsets.all(21),
|
||||
itemBuilder: (cxt, int index) => Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
ItemDetailView(LocaleKeys.startDateT.tr(), absenceTransList![index].sTARTDATE ?? ""),
|
||||
ItemDetailView(LocaleKeys.endDateT.tr(), absenceTransList![index].eNDDATE ?? ""),
|
||||
ItemDetailView(LocaleKeys.absenceType.tr(), absenceTransList![index].aBSENCETYPE ?? ""),
|
||||
ItemDetailView(LocaleKeys.absenceCategory.tr(), absenceTransList![index].aBSENCECATEGORY ?? ""),
|
||||
ItemDetailView(LocaleKeys.days.tr(), absenceTransList![index].aBSENCEDAYS?.toString() ?? ""),
|
||||
ItemDetailView(LocaleKeys.hours.tr(), absenceTransList![index].aBSENCEHOURS?.toString() ?? ""),
|
||||
ItemDetailView(LocaleKeys.approvalStatus.tr(), absenceTransList![index].aPPROVALSTATUS ?? ""),
|
||||
ItemDetailView(LocaleKeys.absenceStatus.tr(), absenceTransList![index].aBSENCESTATUS ?? ""),
|
||||
],
|
||||
).objectContainerView(),
|
||||
separatorBuilder: (cxt, index) => 12.height,
|
||||
itemCount: absenceTransList!.length)),
|
||||
floatingActionButton: Container(
|
||||
height: 54,
|
||||
width: 54,
|
||||
decoration: const BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
gradient: LinearGradient(transform: GradientRotation(.83), begin: Alignment.topRight, end: Alignment.bottomLeft, colors: [
|
||||
MyColors.gradiantEndColor,
|
||||
MyColors.gradiantStartColor,
|
||||
]),
|
||||
),
|
||||
child: const Icon(Icons.add, color: Colors.white, size: 30),
|
||||
).onPress(() {
|
||||
Navigator.pushNamed(context, AppRoutes.addLeaveBalance);
|
||||
}),
|
||||
);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue