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.
157 lines
7.0 KiB
Dart
157 lines
7.0 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:mohem_flutter_app/api/my_team/my_team_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/string_extensions.dart';
|
|
import 'package:mohem_flutter_app/models/my_team/get_employee_subordinates_list.dart';
|
|
import 'package:mohem_flutter_app/widgets/app_bar_widget.dart';
|
|
import 'package:url_launcher/url_launcher.dart';
|
|
|
|
class TeamMembers extends StatefulWidget {
|
|
const TeamMembers({Key? key}) : super(key: key);
|
|
|
|
@override
|
|
_TeamMembersState createState() => _TeamMembersState();
|
|
}
|
|
|
|
class _TeamMembersState extends State<TeamMembers> {
|
|
String searchEmpEmail ="";
|
|
String searchEmpName ="";
|
|
String searchEmpNo = "";
|
|
String? empId;
|
|
List<GetEmployeeSubordinatesList> getEmployeeSubordinatesList = [];
|
|
GetEmployeeSubordinatesList? getEmployeeSubordinates;
|
|
|
|
void initState() {
|
|
super.initState();
|
|
employeeSubordinates();
|
|
setState(() {});
|
|
|
|
}
|
|
|
|
void employeeSubordinates() async {
|
|
try {
|
|
Utils.showLoading(context);
|
|
getEmployeeSubordinatesList = await MyTeamApiClient().getEmployeeSubordinates(searchEmpEmail.toString(), searchEmpName.toString(), searchEmpNo.toString());
|
|
getEmployeeSubordinatesList = await MyTeamApiClient().employeeSubordinates(searchEmpEmail.toString(), searchEmpName.toString(), searchEmpNo.toString(),getEmployeeSubordinates?.eMPLOYEENUMBER);
|
|
Utils.hideLoading(context);
|
|
setState(() {});
|
|
} catch (ex) {
|
|
Utils.hideLoading(context);
|
|
Utils.handleException(ex, context, null);
|
|
}
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
getEmployeeSubordinates ??= ModalRoute.of(context)?.settings.arguments as GetEmployeeSubordinatesList;
|
|
return Scaffold(
|
|
appBar: AppBarWidget(
|
|
context,
|
|
title: "Team Members",
|
|
),
|
|
backgroundColor: MyColors.backgroundColor,
|
|
body: SingleChildScrollView(
|
|
child: Column(
|
|
children: [
|
|
Container(
|
|
width: MediaQuery.of(context).size.width,
|
|
child: SingleChildScrollView(
|
|
scrollDirection: Axis.vertical,
|
|
child: Column(
|
|
children: <Widget>[
|
|
if(getEmployeeSubordinatesList != 0)
|
|
ListView.builder(
|
|
scrollDirection: Axis.vertical,
|
|
shrinkWrap: true,
|
|
physics: ScrollPhysics(),
|
|
itemCount: getEmployeeSubordinatesList.length,
|
|
itemBuilder: (context, index) {
|
|
var phoneNumber = Uri.parse('tel:${getEmployeeSubordinatesList[index].eMPLOYEENUMBER}');
|
|
return Container(
|
|
width: double.infinity,
|
|
margin: EdgeInsets.only(
|
|
top: 18,
|
|
left: 18,
|
|
right: 18,
|
|
),
|
|
padding: EdgeInsets.only(left: 10, right: 10, top: 10, bottom: 10),
|
|
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: Row(
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
children: [
|
|
Row(
|
|
children: [
|
|
Column(
|
|
children: [
|
|
CircleAvatar(
|
|
radius: 25,
|
|
backgroundImage: MemoryImage(Utils.getPostBytes(getEmployeeSubordinatesList[index].eMPLOYEEIMAGE)),
|
|
backgroundColor: Colors.black,
|
|
),
|
|
// MyTeamImage()
|
|
],
|
|
),
|
|
SizedBox(
|
|
width: 10,
|
|
),
|
|
Column(
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
children: [
|
|
"Present".toText13(color: MyColors.greenColor),
|
|
"${getEmployeeSubordinatesList[index].eMPLOYEENAME}".toText16(color: MyColors.blackColor),
|
|
"${getEmployeeSubordinatesList[index].pOSITIONNAME}".toText13(color: MyColors.blackColor),
|
|
],
|
|
),
|
|
],
|
|
),
|
|
Column(
|
|
children: [
|
|
IconButton(
|
|
onPressed: () {
|
|
launchUrl(phoneNumber);
|
|
},
|
|
icon: Icon(
|
|
Icons.whatsapp,
|
|
color: Colors.green,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}),
|
|
Container(
|
|
margin: EdgeInsets.only(top:30),
|
|
child: "No Members".toText16(isBold: true, color: MyColors.black),
|
|
)
|
|
],
|
|
),
|
|
)
|
|
// SizedBox(height: 20),
|
|
)
|
|
],
|
|
),
|
|
));
|
|
}
|
|
|
|
Widget MyTeamImage() => CircleAvatar(
|
|
radius: 30,
|
|
//backgroundImage: MemoryImage(Utils.getPostBytes(memberInformationList.eMPLOYEEIMAGE)),
|
|
backgroundColor: Colors.black,
|
|
);
|
|
}
|