You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
198 lines
6.7 KiB
Dart
198 lines
6.7 KiB
Dart
import 'package:easy_localization/src/public_ext.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:mohem_flutter_app/api/profile_api_client.dart';
|
|
import 'package:mohem_flutter_app/classes/colors.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/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/ui/profile/phone_numbers.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';
|
|
|
|
class ContactDetails extends StatefulWidget {
|
|
const ContactDetails({Key? key}) : super(key: key);
|
|
|
|
@override
|
|
_ContactDetailsState createState() => _ContactDetailsState();
|
|
}
|
|
|
|
class _ContactDetailsState extends State<ContactDetails> {
|
|
String? fullName = "";
|
|
String? maritalStatus = "";
|
|
String? birthDate = "";
|
|
String? civilIdentityNumber = "";
|
|
String? emailAddress = "";
|
|
String? employeeNo = "";
|
|
|
|
List<GetEmployeePhonesList> getEmployeePhonesList = [];
|
|
List<GetEmployeeAddressList> getEmployeeAddressList = [];
|
|
|
|
@override
|
|
void initState() {
|
|
super.initState();
|
|
|
|
getEmployeePhones();
|
|
|
|
setState(() {});
|
|
}
|
|
|
|
void getEmployeePhones() async {
|
|
try {
|
|
Utils.showLoading(context);
|
|
getEmployeePhonesList = await ProfileApiClient().getEmployeePhones();
|
|
getEmployeeAddress();
|
|
Utils.hideLoading(context);
|
|
setState(() {});
|
|
} catch (ex) {
|
|
Utils.hideLoading(context);
|
|
Utils.handleException(ex, context, null);
|
|
}
|
|
}
|
|
|
|
void getEmployeeAddress() async {
|
|
try {
|
|
Utils.showLoading(context);
|
|
getEmployeeAddressList = await ProfileApiClient().getEmployeeAddress();
|
|
Utils.hideLoading(context);
|
|
setState(() {});
|
|
} catch (ex) {
|
|
Utils.hideLoading(context);
|
|
Utils.handleException(ex, context, null);
|
|
}
|
|
}
|
|
|
|
Widget build(BuildContext context) {
|
|
return Scaffold(
|
|
appBar: AppBarWidget(
|
|
context,
|
|
title: LocaleKeys.profile_contactDetails.tr(),
|
|
),
|
|
backgroundColor: MyColors.backgroundColor,
|
|
bottomSheet: footer(),
|
|
body: SingleChildScrollView(
|
|
child: Column(children: [
|
|
Container(
|
|
width: double.infinity,
|
|
margin: EdgeInsets.only(
|
|
top: 20,
|
|
left: 26,
|
|
right: 26,
|
|
),
|
|
padding: EdgeInsets.all(15),
|
|
|
|
///height: 200,
|
|
decoration: BoxDecoration(
|
|
boxShadow: [
|
|
BoxShadow(
|
|
color: Colors.grey.withOpacity(0.5),
|
|
spreadRadius: 5,
|
|
blurRadius: 26,
|
|
offset: Offset(0, 3),
|
|
),
|
|
],
|
|
color: Colors.white,
|
|
borderRadius: BorderRadius.circular(10.0),
|
|
),
|
|
child: Stack(children: [
|
|
Row(
|
|
mainAxisAlignment: MainAxisAlignment.end,
|
|
children: [
|
|
IconButton(
|
|
icon: Icon(
|
|
Icons.edit_location_alt_outlined,
|
|
size: 20,
|
|
),
|
|
onPressed: () {
|
|
updatePhone();
|
|
},
|
|
)
|
|
],
|
|
),
|
|
Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: getEmployeePhonesList
|
|
.map((e) => Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
|
|
"${e.pHONETYPEMEANING}".toText13(color: MyColors.lightGrayColor),
|
|
"${e.pHONENUMBER}".toText16(isBold: true, color: MyColors.blackColor),
|
|
]))
|
|
.toList())
|
|
])),
|
|
Container(
|
|
width: double.infinity,
|
|
margin: EdgeInsets.only(
|
|
top: 20,
|
|
left: 26,
|
|
right: 26,
|
|
),
|
|
padding: EdgeInsets.all(15),
|
|
// height: 400,
|
|
decoration: BoxDecoration(
|
|
boxShadow: [
|
|
BoxShadow(
|
|
color: Colors.grey.withOpacity(0.5),
|
|
spreadRadius: 5,
|
|
blurRadius: 26,
|
|
offset: Offset(0, 3),
|
|
),
|
|
],
|
|
color: Colors.white,
|
|
borderRadius: BorderRadius.circular(10.0),
|
|
),
|
|
child: Stack(children: [
|
|
Row(
|
|
mainAxisAlignment: MainAxisAlignment.end,
|
|
children: [
|
|
IconButton(
|
|
icon: Icon(
|
|
Icons.edit_location_alt_outlined,
|
|
size: 20,
|
|
),
|
|
onPressed: () {},
|
|
)
|
|
],
|
|
),
|
|
Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: getEmployeeAddressList
|
|
.map((e) => Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
|
|
"${e.sEGMENTPROMPT}".toText13(color: MyColors.lightGrayColor),
|
|
"${e.sEGMENTVALUEDSP}".toText16(isBold: true, color: MyColors.blackColor),
|
|
SizedBox(
|
|
height: 20,
|
|
),
|
|
]))
|
|
.toList())
|
|
]))
|
|
])));
|
|
}
|
|
|
|
footer() {
|
|
return Container(
|
|
decoration: BoxDecoration(
|
|
// borderRadius: BorderRadius.circular(10),
|
|
color: MyColors.white,
|
|
boxShadow: [
|
|
BoxShadow(color: MyColors.lightGreyEFColor, spreadRadius: 3),
|
|
],
|
|
),
|
|
child: DefaultButton(LocaleKeys.update.tr(), () async {
|
|
// context.setLocale(const Locale("en", "US")); // to change Loacle
|
|
Profile();
|
|
}).insideContainer,
|
|
);
|
|
}
|
|
|
|
updatePhone() {
|
|
Navigator.push(
|
|
context,
|
|
MaterialPageRoute(builder: (context) => PhoneNumbers(getEmployeePhonesList: this.getEmployeePhonesList)),
|
|
);
|
|
}
|
|
}
|