diff --git a/assets/images/user.svg b/assets/images/user.svg new file mode 100644 index 0000000..13d9aed --- /dev/null +++ b/assets/images/user.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/assets/langs/ar-SA.json b/assets/langs/ar-SA.json index 7e2048d..1ba7218 100644 --- a/assets/langs/ar-SA.json +++ b/assets/langs/ar-SA.json @@ -356,6 +356,8 @@ "hours": "ساعات", "approvalStatus": "حالة القبول", "absenceStatus": "حالة الغياب", + "subordinateLeave": "إجازة التابعيين", + "numberDays": "عدد الأيام", "profile": { "reset_password": { "label": "Reset Password", diff --git a/assets/langs/en-US.json b/assets/langs/en-US.json index 38765dd..47d33b9 100644 --- a/assets/langs/en-US.json +++ b/assets/langs/en-US.json @@ -356,6 +356,8 @@ "hours": "Hours", "approvalStatus": "Approval Status", "absenceStatus": "Absence Status", + "subordinateLeave": "Subordinate Leave", + "numberDays": "Number of days", "profile": { "reset_password": { "label": "Reset Password", diff --git a/lib/api/my_team/my_team_api_client.dart b/lib/api/my_team/my_team_api_client.dart index 4a843c1..c5a78c6 100644 --- a/lib/api/my_team/my_team_api_client.dart +++ b/lib/api/my_team/my_team_api_client.dart @@ -9,6 +9,7 @@ import 'package:mohem_flutter_app/models/generic_response_model.dart'; import 'package:mohem_flutter_app/models/get_day_hours_type_details_list_model.dart'; import 'package:mohem_flutter_app/models/get_time_card_summary_list_model.dart'; import 'package:mohem_flutter_app/models/my_team/get_employee_subordinates_list.dart'; +import 'package:mohem_flutter_app/models/my_team/get_subordinates_leaves_total_vacations_list_model.dart'; import 'package:mohem_flutter_app/models/worklist/get_favorite_replacements_model.dart'; class MyTeamApiClient { @@ -145,5 +146,18 @@ class MyTeamApiClient { return responseData; }, url, postParams); } + + Future> getSubordinatesLeavesList(String dateFrom, String dateTo) async { + String url = "${ApiConsts.erpRest}GET_SUBORDINATES_LEAVES_TOTAL_VACATIONS"; + Map postParams = { + "P_DATE_FROM": dateFrom, + "P_DATE_TO": dateTo, + }; + postParams.addAll(AppState().postParamsJson); + return await ApiClient().postJsonForObject((json) { + GenericResponseModel responseData = GenericResponseModel.fromJson(json); + return responseData.getSubordinatesLeavesTotalVacationsList ?? []; + }, url, postParams); + } } diff --git a/lib/config/routes.dart b/lib/config/routes.dart index 8b969bf..4b51ca3 100644 --- a/lib/config/routes.dart +++ b/lib/config/routes.dart @@ -21,6 +21,7 @@ import 'package:mohem_flutter_app/ui/my_team/create_request.dart'; import 'package:mohem_flutter_app/ui/my_team/employee_details.dart'; import 'package:mohem_flutter_app/ui/my_team/my_team.dart'; import 'package:mohem_flutter_app/ui/my_team/profile_details.dart'; +import 'package:mohem_flutter_app/ui/my_team/subordinate_leave.dart'; import 'package:mohem_flutter_app/ui/my_team/team_members.dart'; import 'package:mohem_flutter_app/ui/my_team/view_attendance.dart'; import 'package:mohem_flutter_app/ui/payslip/monthly_pay_slip_screen.dart'; @@ -130,6 +131,7 @@ class AppRoutes { static const String viewAttendance = "/viewAttendance"; static const String teamMembers = "/teamMembers"; static const String createRequest = "/createRequest"; + static const String subordinateLeave = "/subordinateLeave"; static final Map routes = { @@ -207,6 +209,7 @@ class AppRoutes { viewAttendance: (context) => ViewAttendance(), teamMembers: (context) => TeamMembers(), createRequest: (context) => CreateRequest(), + subordinateLeave: (context) => SubordinateLeave(), diff --git a/lib/generated/codegen_loader.g.dart b/lib/generated/codegen_loader.g.dart index 53499b8..7452524 100644 --- a/lib/generated/codegen_loader.g.dart +++ b/lib/generated/codegen_loader.g.dart @@ -371,6 +371,8 @@ class CodegenLoader extends AssetLoader{ "hours": "ساعات", "approvalStatus": "حالة القبول", "absenceStatus": "حالة الغياب", + "subordinateLeave": "إجازة التابعيين", + "numberDays": "عدد الأيام", "profile": { "reset_password": { "label": "Reset Password", @@ -762,6 +764,8 @@ static const Map en_US = { "hours": "Hours", "approvalStatus": "Approval Status", "absenceStatus": "Absence Status", + "subordinateLeave": "Subordinate Leave", + "numberDays": "Number of days", "profile": { "reset_password": { "label": "Reset Password", diff --git a/lib/generated/locale_keys.g.dart b/lib/generated/locale_keys.g.dart index 43165af..12fb29a 100644 --- a/lib/generated/locale_keys.g.dart +++ b/lib/generated/locale_keys.g.dart @@ -356,6 +356,8 @@ abstract class LocaleKeys { static const hours = 'hours'; static const approvalStatus = 'approvalStatus'; static const absenceStatus = 'absenceStatus'; + static const subordinateLeave = 'subordinateLeave'; + static const numberDays = 'numberDays'; static const profile_reset_password_label = 'profile.reset_password.label'; static const profile_reset_password_username = 'profile.reset_password.username'; static const profile_reset_password_password = 'profile.reset_password.password'; diff --git a/lib/models/generic_response_model.dart b/lib/models/generic_response_model.dart index 5fca9a3..5ee6007 100644 --- a/lib/models/generic_response_model.dart +++ b/lib/models/generic_response_model.dart @@ -57,6 +57,7 @@ import 'package:mohem_flutter_app/models/mowadhafhi/get_ticket_transactions.dart import 'package:mohem_flutter_app/models/mowadhafhi/get_ticket_types.dart'; import 'package:mohem_flutter_app/models/mowadhafhi/get_tickets_list.dart'; import 'package:mohem_flutter_app/models/my_team/get_employee_subordinates_list.dart'; +import 'package:mohem_flutter_app/models/my_team/get_subordinates_leaves_total_vacations_list_model.dart'; import 'package:mohem_flutter_app/models/notification_action_model.dart'; import 'package:mohem_flutter_app/models/notification_get_respond_attributes_list_model.dart'; import 'package:mohem_flutter_app/models/pending_transactions/get_pending_transactions_details.dart'; @@ -223,7 +224,7 @@ class GenericResponseModel { List? getStampNsNotificationBodyList; List? getSubordinatesAttdStatusList; List? getSubordinatesLeavesList; - List? getSubordinatesLeavesTotalVacationsList; + List?getSubordinatesLeavesTotalVacationsList; List? getSummaryOfPaymentList; List? getSwipesList; List? getTermColsStructureList; @@ -989,7 +990,14 @@ class GenericResponseModel { }); } - getSubordinatesLeavesTotalVacationsList = json['GetSubordinatesLeavesTotalVacationsList']; + if (json['GetSubordinatesLeavesTotalVacationsList'] != null) { + getSubordinatesLeavesTotalVacationsList = + []; + json['GetSubordinatesLeavesTotalVacationsList'].forEach((v) { + getSubordinatesLeavesTotalVacationsList! + .add(new GetSubordinatesLeavesTotalVacationsList.fromJson(v)); + }); + } if (json['GetSummaryOfPaymentList'] != null) { getSummaryOfPaymentList = []; json['GetSummaryOfPaymentList'].forEach((v) { @@ -1542,7 +1550,12 @@ class GenericResponseModel { data['GetSubordinatesLeavesList'] = this.getSubordinatesLeavesList!.map((v) => v.toJson()).toList(); } - data['GetSubordinatesLeavesTotalVacationsList'] = this.getSubordinatesLeavesTotalVacationsList; + if (this.getSubordinatesLeavesTotalVacationsList != null) { + data['GetSubordinatesLeavesTotalVacationsList'] = this + .getSubordinatesLeavesTotalVacationsList! + .map((v) => v.toJson()) + .toList(); + } if (this.getSummaryOfPaymentList != null) { data['GetSummaryOfPaymentList'] = this.getSummaryOfPaymentList!.map((v) => v.toJson()).toList(); } diff --git a/lib/models/my_team/get_subordinates_leaves_total_vacations_list_model.dart b/lib/models/my_team/get_subordinates_leaves_total_vacations_list_model.dart new file mode 100644 index 0000000..04837d8 --- /dev/null +++ b/lib/models/my_team/get_subordinates_leaves_total_vacations_list_model.dart @@ -0,0 +1,62 @@ + + +class GetSubordinatesLeavesTotalVacationsList { + String? aBSENCEATTENDANCETYPENAME; + String? cALENDARENTRYDESC; + String? dATEEND; + String? dATESTART; + String? eMPLOYEENAME; + String? eMPLOYEENUMBER; + String? lEAVETYPE; + int? oRGANIZATIONID; + String? oRGANIZATIONNAME; + String? pOSITIONTITLE; + String? rEPLACEMENTNAME; + String? sTATUS; + + GetSubordinatesLeavesTotalVacationsList( + {this.aBSENCEATTENDANCETYPENAME, + this.cALENDARENTRYDESC, + this.dATEEND, + this.dATESTART, + this.eMPLOYEENAME, + this.eMPLOYEENUMBER, + this.lEAVETYPE, + this.oRGANIZATIONID, + this.oRGANIZATIONNAME, + this.pOSITIONTITLE, + this.rEPLACEMENTNAME, + this.sTATUS}); + + GetSubordinatesLeavesTotalVacationsList.fromJson(Map json) { + aBSENCEATTENDANCETYPENAME = json['ABSENCE_ATTENDANCE_TYPE_NAME']; + cALENDARENTRYDESC = json['CALENDAR_ENTRY_DESC']; + dATEEND = json['DATE_END']; + dATESTART = json['DATE_START']; + eMPLOYEENAME = json['EMPLOYEE_NAME']; + eMPLOYEENUMBER = json['EMPLOYEE_NUMBER']; + lEAVETYPE = json['LEAVE_TYPE']; + oRGANIZATIONID = json['ORGANIZATION_ID']; + oRGANIZATIONNAME = json['ORGANIZATION_NAME']; + pOSITIONTITLE = json['POSITION_TITLE']; + rEPLACEMENTNAME = json['REPLACEMENT_NAME']; + sTATUS = json['STATUS']; + } + + Map toJson() { + Map data = new Map(); + data['ABSENCE_ATTENDANCE_TYPE_NAME'] = this.aBSENCEATTENDANCETYPENAME; + data['CALENDAR_ENTRY_DESC'] = this.cALENDARENTRYDESC; + data['DATE_END'] = this.dATEEND; + data['DATE_START'] = this.dATESTART; + data['EMPLOYEE_NAME'] = this.eMPLOYEENAME; + data['EMPLOYEE_NUMBER'] = this.eMPLOYEENUMBER; + data['LEAVE_TYPE'] = this.lEAVETYPE; + data['ORGANIZATION_ID'] = this.oRGANIZATIONID; + data['ORGANIZATION_NAME'] = this.oRGANIZATIONNAME; + data['POSITION_TITLE'] = this.pOSITIONTITLE; + data['REPLACEMENT_NAME'] = this.rEPLACEMENTNAME; + data['STATUS'] = this.sTATUS; + return data; + } +} \ No newline at end of file diff --git a/lib/ui/my_team/employee_details.dart b/lib/ui/my_team/employee_details.dart index 2ef488b..26c844f 100644 --- a/lib/ui/my_team/employee_details.dart +++ b/lib/ui/my_team/employee_details.dart @@ -65,8 +65,12 @@ class _EmployeeDetailsState extends State { @override Widget build(BuildContext context) { - getEmployeeSubordinates = ModalRoute.of(context)?.settings.arguments as GetEmployeeSubordinatesList; - setMenu(); + if(getEmployeeSubordinates == null) { + getEmployeeSubordinates = ModalRoute.of(context)?.settings.arguments as GetEmployeeSubordinatesList; + setMenu(); + } + + return Scaffold( extendBody: true, backgroundColor: MyColors.lightGreyEFColor, @@ -125,7 +129,6 @@ class _EmployeeDetailsState extends State { child: Stack(children: [ Container( width: _width, - //height: 150, margin: EdgeInsets.only(top: 50), //padding: EdgeInsets.only(right: 17, left: 17), decoration: BoxDecoration( @@ -164,7 +167,6 @@ class _EmployeeDetailsState extends State { color: MyColors.green9CColor, ), ), - // Container(height: 100, alignment: Alignment.center, child: ProfileImage()), InkWell( onTap:() { launchUrl(phoneNumber); @@ -181,7 +183,7 @@ class _EmployeeDetailsState extends State { customLabel(getEmployeeSubordinates!.eMPLOYEENUMBER.toString() + ' | ' + getEmployeeSubordinates!.jOBNAME.toString(), 13, MyColors.grey80Color, true), customLabel(getEmployeeSubordinates!.eMPLOYEEEMAILADDRESS.toString(), 13, MyColors.grey3AColor, true), ], - ).paddingOnly(bottom: 10), + ).paddingOnly(bottom: 10, left: 35,right: 31), ], ), ), diff --git a/lib/ui/my_team/my_team.dart b/lib/ui/my_team/my_team.dart index 7366128..15ce3d2 100644 --- a/lib/ui/my_team/my_team.dart +++ b/lib/ui/my_team/my_team.dart @@ -55,46 +55,60 @@ class _MyTeamState extends State { appBar: AppBarWidget( context, title: LocaleKeys.myTeamMembers.tr(), + showMemberButton: true, ), backgroundColor: MyColors.backgroundColor, body: SingleChildScrollView( child: Column( children: [ - Row(mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Expanded( - child: TextField( - onChanged: dropdownValue == "Name" - ? (String value) { - getEmployeeSListOnSearch = - getEmployeeSubordinatesList.where((GetEmployeeSubordinatesList element) => element.eMPLOYEENAME!.toLowerCase().contains(value.toLowerCase())).toList(); - setState(() {}); - } - : (String value) { - getEmployeeSListOnSearch = - getEmployeeSubordinatesList.where((GetEmployeeSubordinatesList element) => element.eMPLOYEEEMAILADDRESS!.toLowerCase().contains(value.toLowerCase())).toList(); - setState(() {}); - }, - controller: _textEditingController, - decoration: InputDecoration( - filled: true, - fillColor: Colors.white, - border: InputBorder.none, - enabledBorder: InputBorder.none, - focusedBorder: InputBorder.none, - // contentPadding: EdgeInsets.fromLTRB(10, 15, 10, 15), - hintText: LocaleKeys.searchBy.tr() + " $dropdownValue", - hintStyle: TextStyle(fontSize: 14.0, color: MyColors.grey57Color, fontWeight: FontWeight.w600), + Container( + margin: EdgeInsets.only(left: 21, right: 21, top: 20, bottom: 6), + padding: EdgeInsets.only(left: 14, right: 14, top: 21, bottom: 21), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(15), + color: Color(0xffFFFFFF), + border: Border.all( + color: Color(0xffefefef), + width: 1, ), - )), - Row( + ), + child: Row( children: [ - "|".toText16(color: MyColors.greyC4Color), + Expanded( + child: TextField( + onChanged: dropdownValue == "Name" + ? (String value) { + getEmployeeSListOnSearch = + getEmployeeSubordinatesList.where((GetEmployeeSubordinatesList element) => element.eMPLOYEENAME!.toLowerCase().contains(value.toLowerCase())).toList(); + setState(() {}); + } + : (String value) { + getEmployeeSListOnSearch = + getEmployeeSubordinatesList.where((GetEmployeeSubordinatesList element) => element.eMPLOYEEEMAILADDRESS!.toLowerCase().contains(value.toLowerCase())).toList(); + setState(() {}); + }, + controller: _textEditingController, + decoration: InputDecoration( + filled: true, + fillColor: Colors.white, + border: InputBorder.none, + enabledBorder: InputBorder.none, + focusedBorder: InputBorder.none, + // contentPadding: EdgeInsets.fromLTRB(10, 15, 10, 15), + hintText: LocaleKeys.searchBy.tr() + " $dropdownValue", + hintStyle: TextStyle(fontSize: 14.0, color: MyColors.grey57Color, fontWeight: FontWeight.w600), + ), + )), + Container( + height: 36, + width: 1, + color: Color(0xffC4C4C4), + ), 10.width, dropDown(), ], - ) - ]).objectContainerBorderView(), - // ), + ), + ), Container( margin: EdgeInsets.only(left: 21, right: 21), width: MediaQuery.of(context).size.width, @@ -109,7 +123,6 @@ class _MyTeamState extends State { : ListView.separated( scrollDirection: Axis.vertical, shrinkWrap: true, - // padding: EdgeInsets.only(left: 21, right: 21), physics: ScrollPhysics(), separatorBuilder: (cxt, index) => 12.height, itemCount: _textEditingController!.text.isNotEmpty ? getEmployeeSListOnSearch.length : getEmployeeSubordinatesList.length, @@ -162,23 +175,25 @@ class _MyTeamState extends State { } Widget dropDown() { - return DropdownButton( - value: dropdownValue, - icon: const Icon(Icons.keyboard_arrow_down, - color: MyColors.grey57Color), - elevation: 16, - onChanged: (String? newValue) { - setState(() { - dropdownValue = newValue!; - }); - }, - items: ['Name', 'Email'].map>((String value) { - return DropdownMenuItem( - value: value, - child: Text(value), - ); - }).toList(), - style: TextStyle(fontSize: 14.0, color: MyColors.grey57Color, fontWeight: FontWeight.w600), - ); + return + DropdownButton( + value: dropdownValue, + icon: const Icon(Icons.keyboard_arrow_down, + color: MyColors.grey57Color).paddingOnly(left: 4), + elevation: 16, + onChanged: (String? newValue) { + setState(() { + dropdownValue = newValue!; + }); + }, + items: ['Name', 'Email'].map>((String value) { + return DropdownMenuItem( + value: value, + child: Text(value), + ); + }).toList(), + style: TextStyle(fontSize: 14.0, color: MyColors.grey57Color, + fontWeight: FontWeight.w600), + ); } } diff --git a/lib/ui/my_team/profile_details.dart b/lib/ui/my_team/profile_details.dart index 419f897..cfc1730 100644 --- a/lib/ui/my_team/profile_details.dart +++ b/lib/ui/my_team/profile_details.dart @@ -1,15 +1,12 @@ import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; -import 'package:mohem_flutter_app/app_state/app_state.dart'; import 'package:mohem_flutter_app/classes/colors.dart'; import 'package:mohem_flutter_app/extensions/int_extensions.dart'; import 'package:mohem_flutter_app/extensions/string_extensions.dart'; import 'package:mohem_flutter_app/generated/locale_keys.g.dart'; -import 'package:mohem_flutter_app/models/get_employee_basic_details.model.dart'; -import 'package:mohem_flutter_app/models/member_information_list_model.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:mohem_flutter_app/widgets/button/default_button.dart'; + class ProfileDetails extends StatefulWidget { const ProfileDetails({Key? key}) : super(key: key); @@ -19,7 +16,6 @@ class ProfileDetails extends StatefulWidget { } class _ProfileDetailsState extends State { - GetEmployeeSubordinatesList? getEmployeeSubordinates; diff --git a/lib/ui/my_team/subordinate_leave.dart b/lib/ui/my_team/subordinate_leave.dart new file mode 100644 index 0000000..9e69fdc --- /dev/null +++ b/lib/ui/my_team/subordinate_leave.dart @@ -0,0 +1,187 @@ + +import 'dart:io'; + +import 'package:easy_localization/easy_localization.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_svg/flutter_svg.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/date_uitl.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/my_team/get_subordinates_leaves_total_vacations_list_model.dart'; +import 'package:mohem_flutter_app/widgets/app_bar_widget.dart'; +import 'package:mohem_flutter_app/widgets/button/default_button.dart'; +import 'package:mohem_flutter_app/widgets/dynamic_forms/dynamic_textfield_widget.dart'; + + +class SubordinateLeave extends StatefulWidget { + const SubordinateLeave({Key? key}) : super(key: key); + + @override + _SubordinateLeaveState createState() => _SubordinateLeaveState(); +} + +class _SubordinateLeaveState extends State { + List getSubordinatesLeavesTotalList = []; + DateTime selectedDateFrom = DateTime.now(); + DateTime selectedDateTo = DateTime.now(); + bool showList = false; + + + + + @override + void initState() { + super.initState(); + } + + void getSubordinatesLeaves()async { + try { + Utils.showLoading(context); + getSubordinatesLeavesTotalList = await MyTeamApiClient().getSubordinatesLeavesList(DateUtil.convertDateToStringLocation(selectedDateFrom), DateUtil.convertDateToStringLocation(selectedDateTo)); + showList= true; + Utils.hideLoading(context); + setState(() {}); + } catch (ex) { + Utils.hideLoading(context); + Utils.handleException(ex, context, null); + } + } + + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBarWidget( + context, + title: LocaleKeys.subordinateLeave.tr(), + ), + backgroundColor: MyColors.backgroundColor, + body: Column( + children: [ + Expanded( + child: SingleChildScrollView( + scrollDirection: Axis.vertical, + child: Column( + children: [ + Column( + children: [ + DynamicTextFieldWidget( + LocaleKeys.dateFrom.tr(), + selectedDateFrom.toString().split(" ")[0], + suffixIconData: Icons.calendar_today, + isEnable: false, + onTap: () async { + selectedDateFrom = await _selectDate(context, DateTime.now()); + setState(() {}); + }, + ), + 12.height, + DynamicTextFieldWidget( + LocaleKeys.dateTo.tr(), + selectedDateTo.toString().split(" ")[0], + suffixIconData: Icons.calendar_today, + isEnable: false, + onTap: () async { + selectedDateTo = await _selectDate(context, DateTime.now()); + setState(() {}); + }, + ) + ], + ).objectContainerView(), + Container( + margin: EdgeInsets.only(left: 21, right: 21), + width: MediaQuery.of(context).size.width, + child: SingleChildScrollView( + scrollDirection: Axis.vertical, + child: Column( + children: [ + showList? ListView.separated( + scrollDirection: Axis.vertical, + shrinkWrap: true, + physics: ScrollPhysics(), + separatorBuilder: (BuildContext cxt,int index) => 12.height, + itemCount: getSubordinatesLeavesTotalList.length, + itemBuilder: (BuildContext context,int index) { + var diffDays = DateUtil.convertStringToDate(getSubordinatesLeavesTotalList[index].dATEEND!).difference(DateUtil.convertStringToDate(getSubordinatesLeavesTotalList[index].dATESTART!)).inDays; + return getSubordinatesLeavesTotalList.isEmpty + ? Utils.getNoDataWidget(context) + : Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + SvgPicture.asset("assets/images/user.svg"), + 14.width, + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + "${getSubordinatesLeavesTotalList[index].eMPLOYEENAME}".toText16(isBold: true, color: MyColors.grey3AColor), + 10.height, + Row( + children: [ + (LocaleKeys.from.tr() + ': ${DateUtil.getFormattedDate(DateUtil.convertStringToDate(getSubordinatesLeavesTotalList[index].dATESTART!), "MMM dd yyyy")}').toText10(isBold: true, color: MyColors.grey57Color), + 14.width, + (LocaleKeys.to.tr() + ': ${DateUtil.getFormattedDate(DateUtil.convertStringToDate(getSubordinatesLeavesTotalList[index].dATEEND!), "MMM dd yyyy")}').toText10(isBold: true, color: MyColors.grey57Color), + ], + ), + (LocaleKeys.numberDays.tr()+ ": $diffDays").toText10(color: MyColors.grey3AColor), + ], + ).expanded + ], + ).objectContainerView(); + } + ) + :Container(), + ], + ), + ), + ), + ], + ), + ), + ), + DefaultButton( + LocaleKeys.submit.tr(), () async { + getSubordinatesLeaves(); + }).insideContainer + ], + ), + ); + } + + + + Future _selectDate(BuildContext context, DateTime selectedDate) async { + DateTime time = selectedDate; + 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 != null && value != selectedDate) { + time = value; + } + }, + initialDateTime: selectedDate, + ), + ), + ); + } else { + DateTime? picked = await showDatePicker(context: context, initialDate: selectedDate, initialEntryMode: DatePickerEntryMode.calendarOnly, firstDate: DateTime(2015, 8), lastDate: DateTime(2101)); + if (picked != null && picked != selectedDate) { + time = picked; + } + } + return time; + } +} diff --git a/lib/ui/my_team/team_members.dart b/lib/ui/my_team/team_members.dart index f36a13b..37a779d 100644 --- a/lib/ui/my_team/team_members.dart +++ b/lib/ui/my_team/team_members.dart @@ -58,15 +58,16 @@ class _TeamMembersState extends State { scrollDirection: Axis.vertical, child: Column( children: [ - getEmployeeSubordinatesList != 0 - ? ListView.separated( + getEmployeeSubordinatesList.isEmpty + ? Utils.getNoDataWidget(context): + ListView.separated( scrollDirection: Axis.vertical, shrinkWrap: true, padding: EdgeInsets.all(21), physics: ScrollPhysics(), separatorBuilder: (cxt, index) => 12.height, itemCount: getEmployeeSubordinatesList.length, - itemBuilder: (context, index) { + itemBuilder: (BuildContext context, int index) { var phoneNumber = Uri.parse('tel:${getEmployeeSubordinatesList[index].eMPLOYEEMOBILENUMBER}'); return Container( child: Row( @@ -89,18 +90,20 @@ class _TeamMembersState extends State { Column( children: [ IconButton( - onPressed: () { - launchUrl(phoneNumber); + onPressed: () { + launchUrl(phoneNumber); }, icon: Icon( Icons.whatsapp, color: Colors.green, - ),),], - ),], - ),).objectContainerView(); - }): Container( - child: LocaleKeys.noResultsFound.tr().toText16(color: MyColors.blackColor), - ).paddingOnly(top: 10), + ), + ), + ], + ), + ], + ), + ).objectContainerView(); + }), ], ) )); diff --git a/lib/ui/my_team/view_attendance.dart b/lib/ui/my_team/view_attendance.dart index 06b0bce..28ab0f6 100644 --- a/lib/ui/my_team/view_attendance.dart +++ b/lib/ui/my_team/view_attendance.dart @@ -1,21 +1,17 @@ import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; -import 'package:mohem_flutter_app/api/monthly_attendance_api_client.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/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/dashboard/get_attendance_tracking_list_model.dart'; import 'package:mohem_flutter_app/models/get_day_hours_type_details_list_model.dart'; -import 'package:mohem_flutter_app/models/get_schedule_shifts_details_list_model.dart'; import 'package:mohem_flutter_app/models/get_time_card_summary_list_model.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:mohem_flutter_app/widgets/circular_step_progress_bar.dart'; import 'package:month_picker_dialog/month_picker_dialog.dart'; import 'package:pie_chart/pie_chart.dart'; import 'package:syncfusion_flutter_calendar/calendar.dart'; @@ -54,7 +50,6 @@ class _ViewAttendanceState extends State { super.initState(); formattedDate = date; callTimeCardAndHourDetails(date.day, searchMonth, searchYear); - // setState(() {}); } @@ -86,8 +81,7 @@ class _ViewAttendanceState extends State { "Present": getTimeCardSummaryList?.aTTENDEDDAYS != null ? getTimeCardSummaryList!.aTTENDEDDAYS!.toDouble() : 0, "Absent": getTimeCardSummaryList?.aBSENTDAYS != null ? getTimeCardSummaryList!.aBSENTDAYS!.toDouble() : 0, }; - //if(getTimeCardSummaryList ==null) - // callTimeCardAndHourDetails(date.day, searchMonth, searchYear); + return Scaffold( appBar: AppBarWidget( context, @@ -193,7 +187,6 @@ class _ViewAttendanceState extends State { searchMonth = getMonth(selectedDate.month); searchYear = selectedDate.year; formattedDate = selectedDate; //DateFormat('MMMM-yyyy').format(selectedDate); - // _calendarController.selectedDate = formattedDate; callTimeCardAndHourDetails(selectedDate.day, searchMonth, searchYear); } }); @@ -322,7 +315,6 @@ class _ViewAttendanceState extends State { dayFormat: 'EEE', showTrailingAndLeadingDates: false, showAgenda: false, - //navigationDirection: MonthNavigationDirection.vertical, monthCellStyle: MonthCellStyle( textStyle: TextStyle( fontStyle: FontStyle.normal, diff --git a/lib/ui/profile/family_members.dart b/lib/ui/profile/family_members.dart index 3aef900..f81a288 100644 --- a/lib/ui/profile/family_members.dart +++ b/lib/ui/profile/family_members.dart @@ -4,12 +4,13 @@ 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/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/dashboard/menu_entries.dart'; import 'package:mohem_flutter_app/models/get_employee_contacts.model.dart'; import 'package:mohem_flutter_app/provider/dashboard_provider_model.dart'; -import 'package:mohem_flutter_app/ui/profile/dynamic_screens/dynamic_input_familyMembers_screen.dart'; import 'package:mohem_flutter_app/ui/profile/profile_screen.dart'; import 'package:mohem_flutter_app/widgets/app_bar_widget.dart'; import 'package:mohem_flutter_app/widgets/button/default_button.dart'; @@ -58,29 +59,22 @@ class _FamilyMembersState extends State { backgroundColor: MyColors.backgroundColor, body: Column( children: [ + 20.height, Expanded( child: getEmployeeContactsList.length != 0 ? SingleChildScrollView( scrollDirection: Axis.vertical, - child: ListView.builder( + child: ListView.separated( scrollDirection: Axis.vertical, shrinkWrap: true, physics: ScrollPhysics(), + separatorBuilder: (cxt, index) => 12.height, itemCount: getEmployeeContactsList.length, itemBuilder: (context, index) { return Container( width: double.infinity, - margin: EdgeInsets.only( - top: 20, - left: 21, - right: 21, + margin: EdgeInsets.only(left: 21, right: 21, ), - padding: EdgeInsets.only( - left: 14, - right: 14, - top: 13, - ), - height: 110, decoration: BoxDecoration( boxShadow: [ BoxShadow( @@ -90,32 +84,33 @@ class _FamilyMembersState extends State { offset: Offset(0, 3), ), ], - color: MyColors.whiteColor, + color: Colors.white, borderRadius: BorderRadius.circular(10.0), ), - child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ - "${getEmployeeContactsList[index].cONTACTNAME}".toText16(isBold: true, color: MyColors.grey3AColor), - "${getEmployeeContactsList[index].rELATIONSHIP}".toText11(isBold: true, color: MyColors.textMixColor), - SizedBox( - height: 5, - ), - Divider( - color: MyColors.lightGreyEFColor, - height: 20, - thickness: 1, - indent: 0, - endIndent: 0, - ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - children: [ - Container( - child: menuEntries.updateButton == 'Y' + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + "${getEmployeeContactsList[index].cONTACTNAME}".toText16(isBold: true, color: MyColors.grey3AColor), + "${getEmployeeContactsList[index].rELATIONSHIP}".toText11(isBold: true, color: MyColors.textMixColor), + ]).paddingOnly(left: 14, right: 14, top: 13, bottom: 11), + const Divider( + color: Color(0xffEFEFEF), + thickness: 1, + indent: 0, + endIndent: 0, + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: [ + menuEntries.updateButton == 'Y' ? InkWell( onTap: () async{ relationId = getEmployeeContactsList[index]!.cONTACTRELATIONSHIPID!.toInt(); showUpdateAlertDialog(context, relationId!.toInt(), 2, LocaleKeys.update.tr()); - }, + }, child: RichText( text: TextSpan( children: [ @@ -136,8 +131,8 @@ class _FamilyMembersState extends State { ), ], ), - ), - ) + ), + ) : RichText( text: TextSpan( children: [ @@ -158,23 +153,18 @@ class _FamilyMembersState extends State { ), ], ), - ) ), - Padding( - padding: const EdgeInsets.symmetric(horizontal: 8), - child: SizedBox( - child: Container( - width: 3, - color: MyColors.lightGreyEFColor, ), - ), - ), - Container( - child: InkWell( - onTap: () { + Container( + height: 35, + width: 1, + color: Color(0xffEFEFEF), + ), + InkWell( + onTap: () { relationId = getEmployeeContactsList[index]!.cONTACTRELATIONSHIPID!.toInt(); showRemoveAlertDialog(context, relationId!.toInt()); - }, - child: RichText( + }, + child: RichText( text: TextSpan( children: [ WidgetSpan( @@ -194,11 +184,12 @@ class _FamilyMembersState extends State { ), ], ), - ), - )), - ], - ), - ]), + ), + ), + ], + ).paddingOnly(left: 14, right: 14), + ], + ), ); }), ) diff --git a/lib/widgets/app_bar_widget.dart b/lib/widgets/app_bar_widget.dart index 806fe6b..770494e 100644 --- a/lib/widgets/app_bar_widget.dart +++ b/lib/widgets/app_bar_widget.dart @@ -5,7 +5,7 @@ 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'; -AppBar AppBarWidget(BuildContext context, {required String title, bool showHomeButton = false, bool showNotificationButton = false}) { +AppBar AppBarWidget(BuildContext context, {required String title, bool showHomeButton = false, bool showNotificationButton = false, bool showMemberButton = false}) { return AppBar( leadingWidth: 0, // leading: GestureDetector( @@ -44,14 +44,16 @@ AppBar AppBarWidget(BuildContext context, {required String title, bool showHomeB IconButton( onPressed: () { Navigator.pushNamed(context, AppRoutes.worklistSettings); - // Navigator.pushAndRemoveUntil( - // context, - // MaterialPageRoute(builder: (context) => LandingPage()), - // (Route route) => false, - // ); }, icon: const Icon(Icons.notifications, color: MyColors.textMixColor), ), + if(showMemberButton) + IconButton( + onPressed: () { + Navigator.pushNamed(context, AppRoutes.subordinateLeave); + }, + icon: const Icon(Icons.people, color: MyColors.textMixColor), + ), ], ); }