PHONE NUMBERS

merge-requests/1/merge
Sultan Khan 2 years ago
parent 794cd2b1e8
commit 23326a769a

@ -1,4 +1,5 @@
import 'dart:async';
import 'dart:convert';
import 'package:mohem_flutter_app/app_state/app_state.dart';
import 'package:mohem_flutter_app/classes/consts.dart';
@ -9,6 +10,7 @@ import 'package:mohem_flutter_app/models/get_employee_basic_details.model.dart';
import 'package:mohem_flutter_app/models/get_employee_contacts.model.dart';
import 'package:mohem_flutter_app/models/get_employee_phones_model.dart';
import 'package:mohem_flutter_app/models/profile/phone_number_types_modek.dart';
import 'package:mohem_flutter_app/models/profile/submit_phone_transactions.dart';
import 'api_client.dart';
class ProfileApiClient {
@ -129,4 +131,14 @@ class ProfileApiClient {
return responseData.getObjectValuesList ?? [];
}, url, postParams);
}
Future<SubmitPhonesTransactionList> submitPhoneNumbers(List<GetEmployeePhonesList> empList) async {
String url = "${ApiConsts.erpRest}SUBMIT_PHONES_TRANSACTION";
Map<String, dynamic> postParams = {"P_MENU_TYPE": "E", "P_SELECTED_RESP_ID": -999, "P_FUNCTION_NAME": "HR_PERINFO_SS", "P_MBL_PHONES_TBL": empList};
postParams.addAll(AppState().postParamsJson);
return await ApiClient().postJsonForObject((json) {
GenericResponseModel? responseData = GenericResponseModel.fromJson(json);
return responseData.submitPhonesTransactionList ?? SubmitPhonesTransactionList();
}, url, postParams);
}
}

@ -26,6 +26,7 @@ import 'package:mohem_flutter_app/models/notification_get_respond_attributes_lis
import 'package:mohem_flutter_app/models/profile/basic_details_cols_structions.dart';
import 'package:mohem_flutter_app/models/profile/basic_details_dff_structure.dart';
import 'package:mohem_flutter_app/models/profile/phone_number_types_modek.dart';
import 'package:mohem_flutter_app/models/profile/submit_phone_transactions.dart';
import 'package:mohem_flutter_app/models/subordinates_on_leaves_model.dart';
import 'package:mohem_flutter_app/models/worklist_response_model.dart';
@ -264,7 +265,7 @@ class GenericResponseModel {
String? submitContactTransactionList;
String? submitEITTransactionList;
String? submitHrTransactionList;
String? submitPhonesTransactionList;
SubmitPhonesTransactionList? submitPhonesTransactionList;
String? submitSITTransactionList;
String? submitTermTransactionList;
List<SubordinatesLeavesList>? subordinatesOnLeavesList;
@ -950,6 +951,7 @@ class GenericResponseModel {
submitEITTransactionList = json['SubmitEITTransactionList'];
submitHrTransactionList = json['SubmitHrTransactionList'];
submitPhonesTransactionList = json['SubmitPhonesTransactionList'];
submitSITTransactionList = json['SubmitSITTransactionList'];
submitTermTransactionList = json['SubmitTermTransactionList'];

@ -0,0 +1,24 @@
class SubmitPhonesTransactionList {
String? pITEMKEY;
String? pRETURNMSG;
String? pRETURNSTATUS;
int? pTRANSACTIONID;
SubmitPhonesTransactionList({this.pITEMKEY, this.pRETURNMSG, this.pRETURNSTATUS, this.pTRANSACTIONID});
SubmitPhonesTransactionList.fromJson(Map<String, dynamic> json) {
pITEMKEY = json['P_ITEM_KEY'];
pRETURNMSG = json['P_RETURN_MSG'];
pRETURNSTATUS = json['P_RETURN_STATUS'];
pTRANSACTIONID = json['P_TRANSACTION_ID'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['P_ITEM_KEY'] = this.pITEMKEY;
data['P_RETURN_MSG'] = this.pRETURNMSG;
data['P_RETURN_STATUS'] = this.pRETURNSTATUS;
data['P_TRANSACTION_ID'] = this.pTRANSACTIONID;
return data;
}
}

@ -1,3 +1,5 @@
import 'dart:convert';
import 'package:easy_localization/src/public_ext.dart';
import 'package:flutter/material.dart';
import 'package:mohem_flutter_app/api/profile_api_client.dart';
@ -11,6 +13,7 @@ import 'package:mohem_flutter_app/models/get_employee_address_model.dart';
import 'package:mohem_flutter_app/models/get_employee_basic_details.model.dart';
import 'package:mohem_flutter_app/models/get_employee_phones_model.dart';
import 'package:mohem_flutter_app/models/profile/phone_number_types_modek.dart';
import 'package:mohem_flutter_app/models/profile/submit_phone_transactions.dart';
import 'package:mohem_flutter_app/ui/profile/profile.dart';
import 'package:mohem_flutter_app/widgets/app_bar_widget.dart';
import 'package:mohem_flutter_app/widgets/button/default_button.dart';
@ -27,6 +30,7 @@ class PhoneNumbers extends StatefulWidget {
class _PhoneNumbersState extends State<PhoneNumbers> {
List<GetPhoneNumberTypesModel> getPhoneNumberTypesList = [];
SubmitPhonesTransactionList submitPhoneNumbers = SubmitPhonesTransactionList();
@override
void initState() {
super.initState();
@ -155,7 +159,6 @@ class _PhoneNumbersState extends State<PhoneNumbers> {
footer() {
return Container(
decoration: BoxDecoration(
// borderRadius: BorderRadius.circular(10),
color: MyColors.white,
boxShadow: [
BoxShadow(color: MyColors.lightGreyEFColor, spreadRadius: 3),
@ -163,16 +166,26 @@ class _PhoneNumbersState extends State<PhoneNumbers> {
),
child: DefaultButton(LocaleKeys.update.tr(), () async {
updatePhone();
// context.setLocale(const Locale("en", "US")); // to change Loacle
// Profile();
}).insideContainer,
);
}
void updatePhone() {
void updatePhone() async {
Utils.showLoading(context);
setUpdateStatus();
submitPhoneNumbers = await ProfileApiClient().submitPhoneNumbers(widget.getEmployeePhonesList);
setState(() {});
Utils.hideLoading(context);
print(widget.getEmployeePhonesList);
}
void setUpdateStatus() {
widget.getEmployeePhonesList.forEach((element) {
if (element.aCTION == null) element.aCTION = 'UPDATE_ROW';
});
}
void addNewRow() {
setState(() {
widget.getEmployeePhonesList.add(GetEmployeePhonesList(aCTION: 'NEW_ROW'));

Loading…
Cancel
Save