diff --git a/assets/langs/ar-SA.json b/assets/langs/ar-SA.json index bf33153..5f57dbc 100644 --- a/assets/langs/ar-SA.json +++ b/assets/langs/ar-SA.json @@ -24,7 +24,7 @@ "checkIn": "تحقق في", "workList": "قائمة العمل", "leaveBalance": "رصيد الاجازات", - "missingSwipes": "الضربات الشديدة في عداد المفقودين", + "missingSwipes": "تسجيل بصمة حضور", "ticketBalance": "رصيد التذكرة", "other": "آخر", "services": "خدمات", @@ -56,10 +56,10 @@ "order": "الطلبات", "earlyOut": "الخروج مبكرا", "shortage": "ساعات التقصير", - "excess": "Excess", + "excess": "فائض", "lateIn": "القدوم المتاخر", - "approvedCheckOut": "وقت الخروج", - "approvedCheckIn": "وقت الدخول", + "approvedCheckOut": "اعتماد وقت الخروج", + "approvedCheckIn": "اعتماد وقت الدخول", "actualCheckOut": "وقت الخروج", "actualCheckIn": "وقت الدخول", "present": "حضور", @@ -229,7 +229,7 @@ "approvalLevel": "مستوى الموافقة", "requesterDetails": "تفاصيل مقدم الطلب", "myAttendance": "حضوري", - "workOnBreak": "العمل على استراحة", + "workOnBreak": "التعويض عن العمل اثناءالاستراحه", "next": "التالي", "mobile": "التليفون المحمول", "completingYear": "نحن نقدر لك لاستكمال خدمة", diff --git a/assets/langs/en-US.json b/assets/langs/en-US.json index 8b9a6e6..fed70b9 100644 --- a/assets/langs/en-US.json +++ b/assets/langs/en-US.json @@ -62,10 +62,10 @@ "approvedCheckIn": "Approved Check In", "actualCheckOut": "Actual Check Out", "actualCheckIn": "Actual Check In", - "present": "PRESENT 11", + "present": "PRESENT", "pres": "present", "shiftTime": "Shift Time", - "absent": "ABSENT 10", + "absent": "ABSENT", "attendance": "Attendance", "scheduleDays": "Schedule\nDays", "offDays": "Off\nDays", @@ -245,6 +245,7 @@ "maritalStatus ": "Marital Status ", "fullName": "Full Name", "remove": "Remove", + "Attendance":"Attendance", "profile": { "reset_password": { "label": "Reset Password", diff --git a/lib/api/monthlyAttendance_api_client.dart b/lib/api/monthlyAttendance_api_client.dart index 4f6aca7..bcbf69f 100644 --- a/lib/api/monthlyAttendance_api_client.dart +++ b/lib/api/monthlyAttendance_api_client.dart @@ -26,9 +26,11 @@ class MonthlyAttendanceApiClient { "SearchMonth": month, "SearchYear": year, }; + postParams.addAll(AppState().postParamsJson); return await ApiClient().postJsonForObject((json) { GenericResponseModel? responseData = GenericResponseModel.fromJson(json); + print(responseData); return (responseData.getTimeCardSummaryList?.length ?? 0) > 0 ? responseData.getTimeCardSummaryList!.first : null; }, url, postParams); } @@ -48,7 +50,6 @@ class MonthlyAttendanceApiClient { // postParams["DeviceType"] = deviceType; return await ApiClient().postJsonForObject((json) { GenericResponseModel? responseData = GenericResponseModel.fromJson(json); - print("Response Data______"); print(responseData.getDayHoursTypeDetailsList!.length); return responseData.getDayHoursTypeDetailsList ?? []; }, url, postParams); diff --git a/lib/api/profile_api_client.dart b/lib/api/profile_api_client.dart index 3039e67..3768a64 100644 --- a/lib/api/profile_api_client.dart +++ b/lib/api/profile_api_client.dart @@ -27,6 +27,7 @@ class ProfileApiClient { postParams.addAll(AppState().postParamsJson); return await ApiClient().postJsonForObject((json) { GenericResponseModel? responseData = GenericResponseModel.fromJson(json); + print(responseData); return responseData.getEmployeeContactsList ?? []; }, url, postParams); } diff --git a/lib/config/routes.dart b/lib/config/routes.dart index e377b8a..75f4293 100644 --- a/lib/config/routes.dart +++ b/lib/config/routes.dart @@ -8,6 +8,7 @@ import 'package:mohem_flutter_app/ui/login/verify_last_login_screen.dart'; import 'package:mohem_flutter_app/ui/login/verify_login_screen.dart'; import 'package:mohem_flutter_app/ui/my_attendance/dynamic_screens/dynamic_input_screen.dart'; import 'package:mohem_flutter_app/ui/my_attendance/my_attendance_screen.dart'; +import 'package:mohem_flutter_app/ui/profile/delete_familyMember.dart'; import 'package:mohem_flutter_app/ui/profile/dynamic_screens/dynamic_input_profile_screen.dart'; // import 'package:mohem_flutter_app/ui/my_attendance/work_from_home_screen.dart'; import 'package:mohem_flutter_app/ui/screens/eit/add_eit.dart'; @@ -69,6 +70,7 @@ class AppRoutes { static const String basicDetails = "/basicDetails"; static const String contactDetails = "/contactDetails"; static const String familyMembers = "/familyMembers"; + static const String deleteFamilyMember = "/deleteFamilyMember"; static final Map routes = { login: (context) => LoginScreen(), @@ -110,5 +112,6 @@ class AppRoutes { dynamicScreen: (context) => DynamicListViewScreen(), addDynamicInput: (context) => DynamicInputScreen(), addDynamicInputProfile: (context) => DynamicInputScreenProfile(), + deleteFamilyMember: (context) => DeleteFamilyMember(), }; } diff --git a/lib/extensions/string_extensions.dart b/lib/extensions/string_extensions.dart index 6dab1da..b6cb2dd 100644 --- a/lib/extensions/string_extensions.dart +++ b/lib/extensions/string_extensions.dart @@ -64,7 +64,10 @@ extension EmailValidator on String { this, style: TextStyle(color: color ?? MyColors.darkTextColor, fontSize: 17, letterSpacing: -0.68, fontWeight: isBold ? FontWeight.bold : FontWeight.w600), ); - + Widget toText20({Color? color, bool isBold = false}) => Text( + this, + style: TextStyle(fontSize: 20, fontWeight: isBold ? FontWeight.bold : FontWeight.w600, color: color ?? MyColors.darkTextColor, letterSpacing: -0.4), + ); Widget toText22({Color? color, bool isBold = false}) => Text( this, style: TextStyle(height: 1, color: color ?? MyColors.darkTextColor, fontSize: 22, letterSpacing: -1.44, fontWeight: isBold ? FontWeight.bold : FontWeight.w600), diff --git a/lib/generated/codegen_loader.g.dart b/lib/generated/codegen_loader.g.dart index c5e0f05..c5ea1c4 100644 --- a/lib/generated/codegen_loader.g.dart +++ b/lib/generated/codegen_loader.g.dart @@ -40,7 +40,7 @@ class CodegenLoader extends AssetLoader{ "checkIn": "تحقق في", "workList": "قائمة العمل", "leaveBalance": "رصيد الاجازات", - "missingSwipes": "الضربات الشديدة في عداد المفقودين", + "missingSwipes": "تسجيل بصمة حضور", "ticketBalance": "رصيد التذكرة", "other": "آخر", "services": "خدمات", @@ -69,6 +69,29 @@ class CodegenLoader extends AssetLoader{ "passwordChangedSuccessfully": "تم تغيير الرقم السري بنجاح", "itemsForSale": "سلع للبيع", "attendanceDetails": "تفاصيل الحضور", + "order": "الطلبات", + "earlyOut": "الخروج مبكرا", + "shortage": "ساعات التقصير", + "excess": "فائض", + "lateIn": "القدوم المتاخر", + "approvedCheckOut": "اعتماد وقت الخروج", + "approvedCheckIn": "اعتماد وقت الدخول", + "actualCheckOut": "وقت الخروج", + "actualCheckIn": "وقت الدخول", + "present": "حضور", + "pres": "حضور", + "shiftTime": "وقت التناوب", + "absent": "غياب", + "attendance": "الحضور", + "scheduleDays": "ايام العمل", + "offDays": "ايام الراحه", + "nonAnalyzed": "لايوجد تحليل", + "shortageHour": "ساعات التقصير", + "stats": "الحاله", + "completed": "تم اكمال", + "msg": "Hello {} in the {} world ", + "msg_named": "{} are written in the {lang} language", + "clickMe": "Click me", "doNotUseRecentPassword": "لا تستخدم كلمة مرور حديثة", "atLeastOneLowercase": "حرف صغير واحد على الأقل", "atLeastOneUppercase": "حرف كبير واحد على الأقل", @@ -188,9 +211,6 @@ class CodegenLoader extends AssetLoader{ "rfqUOM": "RFQ UOM", "rfqQty": "RFQ الكمية", "rfqNumber": "رقم RFQ", - "msg": "Hello {} in the {} world ", - "msg_named": "{} are written in the {lang} language", - "clickMe": "Click me", "human": "بشري", "resources": "موارد", "details": "تفاصيل", @@ -225,14 +245,34 @@ class CodegenLoader extends AssetLoader{ "approvalLevel": "مستوى الموافقة", "requesterDetails": "تفاصيل مقدم الطلب", "myAttendance": "حضوري", - "workOnBreak": "العمل على استراحة", + "workOnBreak": "التعويض عن العمل اثناءالاستراحه", "next": "التالي", + "mobile": "التليفون المحمول", + "completingYear": "نحن نقدر لك لاستكمال خدمة", + "year": "سنة", + "month": "شهر", + "day": "يوم", + "address": "العنوان", + "phoneNumber": "رقم الجوال", + "businessGroup": "مجموعة العمل", + "Payroll": "الراتب", + "civilIdentityNumber": "رقم الهويه", + "dateOfBirth": "تاريخ الميلاد", + "maritalStatus ": "الحالة الاجتماعية", + "fullName": "الأسم الكامل", + "remove": "حذف", "profile": { "reset_password": { "label": "Reset Password", "username": "Username", "password": "password" - } + }, + "profileCompletionPer": "استكمال الملف الشخصي", + "completeProfile": "الملف الشخصي الكامل", + "personalInformation": "معلومات شخصية", + "basicDetails": "تفاصيل أساسية", + "contactDetails": "بيانات التواصل", + "familyDetails": "تفاصيل عائلية" }, "clicked": { "zero": "You clicked {} times!", @@ -314,6 +354,27 @@ static const Map en_US = { "confirm": "Confirm", "passwordChangedSuccessfully": "Password changed successfully", "itemsForSale": "Items for Sale", + "attendanceDetails": "Attendance Details", + "order": "order", + "earlyOut": "Early Out", + "shortage": "Shortage", + "excess": "Excess", + "lateIn": "Late In", + "approvedCheckOut": "Approved Check Out", + "approvedCheckIn": "Approved Check In", + "actualCheckOut": "Actual Check Out", + "actualCheckIn": "Actual Check In", + "present": "PRESENT", + "pres": "present", + "shiftTime": "Shift Time", + "absent": "ABSENT", + "attendance": "Attendance", + "scheduleDays": "Schedule\nDays", + "offDays": "Off\nDays", + "nonAnalyzed": "Non\nAnalyzed", + "shortageHour": "Shortage\nHour", + "stats": "Stats", + "completed": "Completed", "doNotUseRecentPassword": "Do not use recent password", "atLeastOneLowercase": "At least one lowercase", "atLeastOneUppercase": "At least one uppercase", @@ -328,7 +389,6 @@ static const Map en_US = { "whatsapp": "Whatsapp", "reject": "Reject", "approve": "Approve", - "attendanceDetails": "Attendence Details", "cancel": "Cancel", "requestedItems": "Requested Items", "request": "Request", @@ -473,12 +533,33 @@ static const Map en_US = { "myAttendance": "My Attendance", "workOnBreak": "Work On Break", "next": "Next", + "mobile": "Mobile", + "year": "Year", + "month": "Month", + "day": "Day", + "completingYear": "We appreciate you for completing the service of", + "address": "Address", + "phoneNumber": "Phone Number", + "businessGroup": "Business", + "Payroll": "Payroll", + "civilIdentityNumber": "Civil Identity Number", + "dateOfBirth": "Date of Birth", + "maritalStatus ": "Marital Status ", + "fullName": "Full Name", + "remove": "Remove", + "Attendance": "Attendance", "profile": { "reset_password": { "label": "Reset Password", "username": "Username", "password": "password" - } + }, + "profileCompletionPer": "Profile Completion", + "completeProfile": "Complete Profile", + "personalInformation": "Personal Information", + "basicDetails": "Basic Details", + "contactDetails": "Contact Details", + "familyDetails": "Family Members" }, "clicked": { "zero": "You clicked {} times!", diff --git a/lib/generated/locale_keys.g.dart b/lib/generated/locale_keys.g.dart index 230e45b..e4bf2dd 100644 --- a/lib/generated/locale_keys.g.dart +++ b/lib/generated/locale_keys.g.dart @@ -232,6 +232,7 @@ abstract class LocaleKeys { static const myAttendance = 'myAttendance'; static const workOnBreak = 'workOnBreak'; static const next = 'next'; + static const mobile = 'mobile'; static const completingYear = 'completingYear'; static const year = 'year'; static const month = 'month'; diff --git a/lib/main.dart b/lib/main.dart index 5e9f705..50f7daf 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -11,6 +11,7 @@ import 'package:mohem_flutter_app/provider/dashboard_provider_model.dart'; import 'package:mohem_flutter_app/provider/eit_provider_model.dart'; import 'package:mohem_flutter_app/theme/app_theme.dart'; import 'package:mohem_flutter_app/widgets/nfc/nfc_reader_sheet.dart'; +import 'package:month_year_picker/month_year_picker.dart'; import 'package:nfc_manager/nfc_manager.dart'; import 'package:nfc_manager/platform_tags.dart'; import 'package:provider/provider.dart'; @@ -30,7 +31,7 @@ Future main() async { await EasyLocalization.ensureInitialized(); await Firebase.initializeApp(); AppState().setPostParamsModel( - PostParamsModel(channel: 31, versionID: 3.6, mobileType: Platform.isAndroid ? "android" : "ios"), + PostParamsModel(channel: 31, versionID: 4.0, mobileType: Platform.isAndroid ? "android" : "ios"), ); runApp( EasyLocalization( @@ -68,12 +69,22 @@ class MyApp extends StatelessWidget { builder: (context, orientation, deviceType) { print(AppState().postParamsObject?.toJson()); var obj = AppState().postParamsObject; - obj?.languageID = EasyLocalization.of(context)?.locale.languageCode == "ar" ? 1 : 2; + obj?.languageID = EasyLocalization + .of(context) + ?.locale + .languageCode == "ar" ? 1 : 2; AppState().setPostParamsModel(obj!); + List delegates = context.localizationDelegates; + // delegates.add(GlobalMaterialLocalizations.delegate); + delegates.add(MonthYearPickerLocalizations.delegate,); return MaterialApp( - theme: AppTheme.getTheme(EasyLocalization.of(context)?.locale.languageCode == "ar"), + theme: AppTheme.getTheme(EasyLocalization + .of(context) + ?.locale + .languageCode == "ar"), debugShowCheckedModeBanner: false, - localizationsDelegates: context.localizationDelegates, + localizationsDelegates + :delegates, supportedLocales: context.supportedLocales, locale: context.locale, initialRoute: AppRoutes.initialRoute, diff --git a/lib/models/get_day_hours_type_details_list_model.dart b/lib/models/get_day_hours_type_details_list_model.dart index 5d0a0ab..daaac74 100644 --- a/lib/models/get_day_hours_type_details_list_model.dart +++ b/lib/models/get_day_hours_type_details_list_model.dart @@ -1,14 +1,14 @@ class GetDayHoursTypeDetailsList { - Null? aBSENCEATTENDANCEID; - Null? aBSENCEATTENDANCETYPEID; + dynamic? aBSENCEATTENDANCEID; + dynamic? aBSENCEATTENDANCETYPEID; String? aBSENTFLAG; String? aCTUALHRS; String? aNALAYZEDFLAG; String? aPPROVEDTIMEBACKHRS; String? aPPRTIMEBACKFLAG; - int? aSSIGNMENTID; + dynamic? aSSIGNMENTID; String? aTTENDEDFLAG; - Null? cALENDARENTRYID; + dynamic? cALENDARENTRYID; String? cOMPOFFFLAG; String? cOMPOFFHRS; String? cOMPOFFHHRS; @@ -19,18 +19,18 @@ class GetDayHoursTypeDetailsList { String? eARLYOUTHRS; String? eXCESSFLAG; String? eXCESSHRS; - int? fROMROWNUM; + dynamic? fROMROWNUM; String? lATEINFLAG; String? lATEINHRS; String? mISSINGSWIPEFLAG; String? nONSCHEDULEDFLAG; - Null? nOOFROWS; + dynamic? nOOFROWS; String? oNCALLHRS; - Null? pERSONEXTRAINFOID; + dynamic? pERSONEXTRAINFOID; String? pLANNEDOTHRS; String? pLANNEDOTHRSFLAG; String? rEMARKS; - int? rOWNUM; + dynamic? rOWNUM; int? rTPID; String? sCHEDULEDHRS; String? sCHEDULEDONCALLHRS; @@ -40,7 +40,7 @@ class GetDayHoursTypeDetailsList { String? sHORTAGEHRS; String? tIMEBACKFLAG; String? tIMEBACKHRS; - int? tOROWNUM; + dynamic? tOROWNUM; GetDayHoursTypeDetailsList( {this.aBSENCEATTENDANCEID, diff --git a/lib/models/get_time_card_summary_list_model.dart b/lib/models/get_time_card_summary_list_model.dart index 6799bfa..727e29f 100644 --- a/lib/models/get_time_card_summary_list_model.dart +++ b/lib/models/get_time_card_summary_list_model.dart @@ -2,39 +2,39 @@ class GetTimeCardSummaryList { int? aBSENTDAYS; - int? aCTUALHRS; - int? aPPROVEDTIMEBACKHRS; + dynamic? aCTUALHRS; + dynamic? aPPROVEDTIMEBACKHRS; int? aSSIGNMENTID; int? aTTENDEDDAYS; int? bUSINESSTRIP; - int? cOMPOFFHHRS; - int? cOMPOFFNHRS; - int? cOMPOFFWHRS; - int? dESIREDSCHEDULEDHRS; - int? eARLYOUTHRS; - int? eXCESSHRS; + dynamic? cOMPOFFHHRS; + dynamic? cOMPOFFNHRS; + dynamic? cOMPOFFWHRS; + dynamic? dESIREDSCHEDULEDHRS; + dynamic? eARLYOUTHRS; + dynamic? eXCESSHRS; int? hALFDAYLEAVE; - int? lATEINHRS; - int? lEAVESHOLIDAYSHRS; - int? nONSCHEDULEDAYS; - int? nOTANALYZEDDAYS; + dynamic? lATEINHRS; + dynamic? lEAVESHOLIDAYSHRS; + dynamic? nONSCHEDULEDAYS; + dynamic? nOTANALYZEDDAYS; int? oFFDAYS; - int? oNCALLHRS; - int? pAIDLEAVE; + dynamic? oNCALLHRS; + dynamic? pAIDLEAVE; int? pERIODDAYS; - int? pLANNEDOTHRS; + dynamic? pLANNEDOTHRS; int? pUBLICHOLIDAY; - int? sCHEDULEDHRS; - int? sCHEDULEDONCALLHRS; - int? sCHEDULEDPLANNEDOTHRS; + dynamic? sCHEDULEDHRS; + dynamic? sCHEDULEDONCALLHRS; + dynamic? sCHEDULEDPLANNEDOTHRS; int? sCHEDULEDAYS; - int? sHORTAGEHRS; - int? sHORTAGESCHEDULEHRS; + dynamic? sHORTAGEHRS; + dynamic? sHORTAGESCHEDULEHRS; int? sICKLEAVE; - int? tIMEBACKHRS; - double? tIMEBACKBALANCE; + dynamic? tIMEBACKHRS; + dynamic? tIMEBACKBALANCE; int? uNAUTHORIZEDLEAVE; - int? uNCOVERDSHORTAGEHRS; + dynamic? uNCOVERDSHORTAGEHRS; int? uNPAIDLEAVE; GetTimeCardSummaryList( diff --git a/lib/ui/attendance/monthly_attendance.dart b/lib/ui/attendance/monthly_attendance.dart index fa531a3..9ec5cdd 100644 --- a/lib/ui/attendance/monthly_attendance.dart +++ b/lib/ui/attendance/monthly_attendance.dart @@ -2,6 +2,7 @@ import 'package:easy_localization/easy_localization.dart'; import 'package:easy_localization/src/public_ext.dart'; import 'package:flutter/material.dart'; import 'package:flutter/painting.dart'; +import 'package:flutter/scheduler.dart'; import 'package:mohem_flutter_app/api/monthlyAttendance_api_client.dart'; import 'package:mohem_flutter_app/classes/colors.dart'; import 'package:mohem_flutter_app/classes/utils.dart'; @@ -17,6 +18,10 @@ import 'package:syncfusion_flutter_calendar/calendar.dart'; import 'package:mohem_flutter_app/generated/locale_keys.g.dart'; import 'package:flutter/cupertino.dart'; import 'package:pie_chart/pie_chart.dart'; +import 'package:flutter_localizations/flutter_localizations.dart'; +import 'package:intl/intl.dart'; +import 'package:month_year_picker/month_year_picker.dart'; +import 'package:month_picker_dialog/month_picker_dialog.dart'; class MonthlyAttendance extends StatefulWidget { MonthlyAttendance({Key? key}) : super(key: key); @@ -28,12 +33,12 @@ class MonthlyAttendance extends StatefulWidget { } class _MonthlyAttendanceState extends State { - bool isPresent = true; - bool isAbsent = true; - bool isMissingDays = true; - bool isOffDays = true; + bool isPresent = false; + bool isAbsent = false; + bool isMissing = false; + bool isOff = false; DateTime date = DateTime.now(); - late var formattedDate; + late DateTime formattedDate; var currentMonth = DateTime.now().month; String searchMonth = getMonth(DateTime.now().month); int searchYear = DateTime.now().year; @@ -41,84 +46,42 @@ class _MonthlyAttendanceState extends State { List getDayHoursTypeDetailsList = []; GetTimeCardSummaryList? getTimeCardSummaryList; - - // GetDayHoursTypeDetailsList? getDayHoursTypeDetailsList; GetScheduleShiftsDetailsList? getScheduleShiftsDetailsList; @override void initState() { super.initState(); - getTimeCardSummary(searchMonth, searchYear); - getDayHoursTypeDetails(date.day, searchMonth, searchYear); - formattedDate = DateFormat('MMM-yyyy').format(date); + formattedDate = date; + callTimeCardAndHourDetails(date.day, searchMonth, searchYear); } - void getTimeCardSummary(searchMonth, searchYear) async { + void callTimeCardAndHourDetails(index, searchMonth, searchYear) async { try { Utils.showLoading(context); getTimeCardSummaryList = await MonthlyAttendanceApiClient().getTimeCardSummary(searchMonth, searchYear); - Utils.hideLoading(context); - setState(() {}); - } catch (ex) { - Utils.hideLoading(context); - Utils.handleException(ex, context, null); - } - } - - void getDayHoursTypeDetails(index, searchMonth, searchYear) async { - try { - Utils.showLoading(context); getDayHoursTypeDetailsList = await MonthlyAttendanceApiClient().getDayHoursTypeDetails(searchMonth, searchYear); Utils.hideLoading(context); - pRTPID = getDayHoursTypeDetailsList[index].rTPID; + _calendarController.displayDate = formattedDate; setState(() {}); } catch (ex) { Utils.hideLoading(context); Utils.handleException(ex, context, null); } - countAllAttendDays(); - getScheduleShiftsDetails(pRTPID); } - getScheduleShiftsDetails(pRTPID) async { + + Future getScheduleShiftsDetails(index, pRTPID) async { try { Utils.showLoading(context); getScheduleShiftsDetailsList = await MonthlyAttendanceApiClient().getScheduleShiftsDetails(pRTPID); Utils.hideLoading(context); - setState(() {}); + //setState(() {}); } catch (ex) { Utils.hideLoading(context); Utils.handleException(ex, context, null); } } - countAllAttendDays() { - // print(getDayHoursTypeDetailsList.length); - for (int i = 0; i < getDayHoursTypeDetailsList.length; i++) { - if (getDayHoursTypeDetailsList[i].aTTENDEDFLAG == 'Y') { - isPresent = true; - isAbsent = false; - isMissingDays = false; - isOffDays = false; - } else if (getDayHoursTypeDetailsList[i].aTTENDEDFLAG == 'N' && getDayHoursTypeDetailsList[i].aBSENTFLAG == 'Y') { - isPresent = false; - isAbsent = true; - isMissingDays = false; - isOffDays = false; - } else if (getDayHoursTypeDetailsList[i].aTTENDEDFLAG == 'N' && getDayHoursTypeDetailsList[i].dAYTYPE == 'OFF') { - isPresent = false; - isAbsent = false; - isMissingDays = false; - isOffDays = true; - } else { - isPresent = false; - isAbsent = false; - isMissingDays = true; - isOffDays = false; - } - } - } - final CalendarController _calendarController = CalendarController(); final List _colorList = [Color(0xff2AB2AB), Color(0xff202529)]; @@ -126,8 +89,8 @@ class _MonthlyAttendanceState extends State { @override Widget build(BuildContext context) { Map dataMap = { - "Present": getTimeCardSummaryList!.aTTENDEDDAYS!.toDouble(), - "Absent": getTimeCardSummaryList!.aBSENTDAYS!.toDouble(), + "Present": getTimeCardSummaryList?.aTTENDEDDAYS != null ? getTimeCardSummaryList!.aTTENDEDDAYS!.toDouble() : 0, + "Absent": getTimeCardSummaryList?.aBSENTDAYS != null ? getTimeCardSummaryList!.aBSENTDAYS!.toDouble() : 0, }; return Scaffold( appBar: AppBar( @@ -150,61 +113,42 @@ class _MonthlyAttendanceState extends State { Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - "Attendance".toText24(isBold: true, color: MyColors.darkIconColor), + LocaleKeys.attendance.tr().toText24(isBold: true, color: MyColors.darkIconColor), Row( children: [ - Text(formattedDate), + "${DateFormat("MMMM-yyyy").format(formattedDate)}".toText16(color: MyColors.greyACColor), const Icon(Icons.keyboard_arrow_down_rounded, color: MyColors.greyACColor), ], ).onPress(() async { - await showDatePicker( - context: context, - initialDate: DateTime.now(), - firstDate: DateTime(2021), + showMonthPicker( + context: context, //locale: EasyLocalization.of(context)?.locale, + initialDate: formattedDate, + firstDate: DateTime(searchYear - 2), lastDate: DateTime.now(), - builder: (context, child) { - return Theme( - data: ThemeData.dark().copyWith( - colorScheme: const ColorScheme.dark( - primary: MyColors.lightGreenColor, - onPrimary: MyColors.white, - surface: MyColors.lightGreenColor, - onSurface: MyColors.darkTextColor, - ), - dialogBackgroundColor: Colors.white, - ), - child: child!, - ); - }, ).then((selectedDate) { if (selectedDate != null) { - var selectedMonth = DateFormat('MMMM').format(selectedDate); - var selectedYear = DateFormat('yyyy').format(selectedDate); - searchMonth = selectedMonth; - searchYear = int.parse(selectedYear); - setState(() { - // date = selectedDate; - formattedDate = DateFormat('MMMM-yyyy').format(selectedDate); - getTimeCardSummary(searchMonth, searchYear); - getDayHoursTypeDetails(selectedDate.day, searchMonth, searchYear); - }); + searchMonth = getMonth(selectedDate.month); + searchYear = selectedDate.year; + formattedDate = selectedDate; //DateFormat('MMMM-yyyy').format(selectedDate); + // _calendarController.selectedDate = formattedDate; + callTimeCardAndHourDetails(selectedDate.day, searchMonth, searchYear); } }); }) ], ).paddingOnly(left: 21, right: 21), 18.height, - AspectRatio(aspectRatio: 333 / 270, child: calendarWidget()).paddingOnly(left: 21, right: 21), + AspectRatio(aspectRatio: 333 / 270, child: calendarWidget()).paddingOnly(left: 18, right: 25), Row( mainAxisAlignment: MainAxisAlignment.start, children: [ - optionUI("Schedule\nDays", "${getTimeCardSummaryList!.sCHEDULEDAYS}"), + optionUI(LocaleKeys.scheduleDays.tr(), "${getTimeCardSummaryList?.sCHEDULEDAYS}"), 6.width, - optionUI("Off\nDays", "${getTimeCardSummaryList!.oFFDAYS}"), + optionUI(LocaleKeys.offDays.tr(), "${getTimeCardSummaryList?.oFFDAYS}"), 6.width, - optionUI("Non\nAnalyzed", "${getTimeCardSummaryList!.uNAUTHORIZEDLEAVE}"), + optionUI(LocaleKeys.nonAnalyzed.tr(), "${getTimeCardSummaryList?.uNAUTHORIZEDLEAVE}"), 6.width, - optionUI("Shortage\nHour", "${getTimeCardSummaryList!.sHORTAGEHRS}"), + optionUI(LocaleKeys.shortageHour.tr(), "${getTimeCardSummaryList?.sHORTAGEHRS}"), ], ).paddingOnly(left: 21, right: 21), 35.height, @@ -229,10 +173,10 @@ class _MonthlyAttendanceState extends State { children: [ Column( children: [ - "Attendance".toText12(isBold: true, color: MyColors.grey3AColor), - "Stats".toText24(isBold: true, color: MyColors.grey3AColor), + LocaleKeys.attendance.tr().toText12(isBold: true, color: MyColors.grey3AColor), + LocaleKeys.stats.tr().toText24(isBold: true, color: MyColors.grey3AColor), ], - ).paddingOnly(left: 21, top: 29, bottom: 36), + ).paddingOnly(left: 21, top: 29, bottom: 36, right: 23), Row( children: [ Container( @@ -245,7 +189,7 @@ class _MonthlyAttendanceState extends State { ), Container( margin: const EdgeInsets.only(left: 5, right: 5), - child: "PRESENT ${getTimeCardSummaryList!.aTTENDEDDAYS}".toText16(isBold: true, color: MyColors.lightGreenColor), + child: "${LocaleKeys.present.tr()} ${getTimeCardSummaryList!.aTTENDEDDAYS}".toText16(isBold: true, color: MyColors.lightGreenColor), ), ], ).paddingOnly(left: 21, right: 23), @@ -262,13 +206,13 @@ class _MonthlyAttendanceState extends State { ), Container( margin: const EdgeInsets.only(left: 5, right: 5), - child: "ABSENT ${getTimeCardSummaryList!.aBSENTDAYS}".toText16( + child: "${LocaleKeys.absent.tr()} ${getTimeCardSummaryList!.aBSENTDAYS}".toText16( isBold: true, color: MyColors.backgroundBlackColor, ), ) ], - ).paddingOnly(left: 21, top: 8), + ).paddingOnly(left: 21, top: 8, right: 23), ], ), Column( @@ -342,70 +286,116 @@ class _MonthlyAttendanceState extends State { Widget calendarWidget() { return SfCalendar( view: CalendarView.month, - // onViewChanged: viewChanged, + showDatePickerButton: false, controller: _calendarController, headerHeight: 0, todayHighlightColor: MyColors.grey3AColor, + showNavigationArrow: false, + showCurrentTimeIndicator: false, + showWeekNumber: false, + cellBorderColor: Colors.white, + selectionDecoration: BoxDecoration( + border: Border.all(color: MyColors.white, width: 10), + borderRadius: const BorderRadius.all(Radius.circular(100)), + shape: BoxShape.circle, + ), + dataSource: MeetingDataSource(_getDataSource()), + onTap: calendarTapped, + monthViewSettings: const MonthViewSettings( + dayFormat: 'EEE', + showTrailingAndLeadingDates: false, + showAgenda: false, + navigationDirection: MonthNavigationDirection.horizontal, + monthCellStyle: MonthCellStyle( + textStyle: TextStyle( + fontStyle: FontStyle.normal, + fontSize: 13, + color: Colors.white, + ), + ), + ), viewHeaderStyle: const ViewHeaderStyle( dayTextStyle: TextStyle(color: MyColors.grey3AColor, fontSize: 13, fontWeight: FontWeight.w600), ), - monthCellBuilder: (cxt, build) { - int val = build.date.day; - val == countAllAttendDays(); - if (isPresent) { - return Container( - margin: const EdgeInsets.all(4), - decoration: BoxDecoration( - gradient: const LinearGradient( - transform: GradientRotation(.46), - begin: Alignment.topRight, - end: Alignment.bottomLeft, - colors: [MyColors.gradiantEndColor, MyColors.gradiantStartColor], + monthCellBuilder: (build, details) { + if (details.date.month == formattedDate.month && details.date.year == formattedDate.year) { + int val = details.date.day; + //check day is off + if (getDayHoursTypeDetailsList[val - 1].aTTENDEDFLAG == 'N' && getDayHoursTypeDetailsList[val - 1].dAYTYPE == 'OFF') { + return Container( + margin: const EdgeInsets.all(4), + decoration: BoxDecoration( + color: MyColors.greyACColor.withOpacity(.12), + shape: BoxShape.circle, ), - shape: BoxShape.circle, - boxShadow: [ - BoxShadow( - offset: const Offset(0, 2), - blurRadius: 26, - color: MyColors.blackColor.withOpacity(0.100), + alignment: Alignment.center, + child: Text( + "${val}", + style: const TextStyle( + fontSize: 13, + fontWeight: FontWeight.w500, + color: MyColors.greyA5Color, ), - ], - ), - alignment: Alignment.center, - child: Text( - "${build.date.day}", - style: const TextStyle( - fontSize: 13, - fontWeight: FontWeight.w500, - color: MyColors.white, ), - ), - ); - } else if (isAbsent) { - return Container( - margin: const EdgeInsets.all(4), - decoration: BoxDecoration( - color: MyColors.backgroundBlackColor, - shape: BoxShape.circle, - boxShadow: [ - BoxShadow( - offset: const Offset(0, 2), - blurRadius: 26, - color: MyColors.blackColor.withOpacity(0.100), + ); + } + //check day is Present + else if (getDayHoursTypeDetailsList[val - 1].aTTENDEDFLAG == 'Y') { + return Container( + margin: const EdgeInsets.all(4), + decoration: BoxDecoration( + gradient: const LinearGradient( + transform: GradientRotation(.46), + begin: Alignment.topRight, + end: Alignment.bottomLeft, + colors: [MyColors.gradiantEndColor, MyColors.gradiantStartColor], ), - ], - ), - alignment: Alignment.center, - child: Text( - "${build.date.day}", - style: const TextStyle( - fontSize: 13, - fontWeight: FontWeight.w500, - color: MyColors.white, + shape: BoxShape.circle, + boxShadow: [ + BoxShadow( + offset: const Offset(0, 2), + blurRadius: 26, + color: MyColors.blackColor.withOpacity(0.100), + ), + ], ), - ), - ); - } else if (isMissingDays) { + alignment: Alignment.center, + child: Text( + "${val}", + style: const TextStyle( + fontSize: 13, + fontWeight: FontWeight.w500, + color: MyColors.white, + ), + ), + ); + } + //check day is Absent + else if (getDayHoursTypeDetailsList[val - 1].aTTENDEDFLAG == 'N' && getDayHoursTypeDetailsList[val - 1].aBSENTFLAG == 'Y') { + return Container( + margin: const EdgeInsets.all(4), + decoration: BoxDecoration( + color: MyColors.backgroundBlackColor, + shape: BoxShape.circle, + boxShadow: [ + BoxShadow( + offset: const Offset(0, 2), + blurRadius: 26, + color: MyColors.blackColor.withOpacity(0.100), + ), + ], + ), + alignment: Alignment.center, + child: Text( + "${val}", + style: const TextStyle( + fontSize: 13, + fontWeight: FontWeight.w500, + color: MyColors.white, + ), + ), + ); + } return Container( margin: const EdgeInsets.all(4), decoration: BoxDecoration( @@ -421,7 +411,7 @@ class _MonthlyAttendanceState extends State { ), alignment: Alignment.center, child: Text( - "${build.date.day}", + "${val}", style: const TextStyle( fontSize: 13, fontWeight: FontWeight.w500, @@ -429,66 +419,35 @@ class _MonthlyAttendanceState extends State { ), ), ); - } else if (isOffDays) { - return Container( - margin: const EdgeInsets.all(4), - decoration: BoxDecoration( - color: MyColors.greyACColor.withOpacity(.12), - shape: BoxShape.circle, - ), - alignment: Alignment.center, - child: Text( - "${build.date.day}", - style: const TextStyle( - fontSize: 13, - fontWeight: FontWeight.w500, - color: MyColors.greyA5Color, - ), - ), - ); + // return Container( + // alignment: Alignment.center, + // child: Text("$val"), + // ); } else { - return Container(); + return const SizedBox(); } }, - monthViewSettings: const MonthViewSettings( - dayFormat: 'EEE', - showTrailingAndLeadingDates: false, - appointmentDisplayMode: MonthAppointmentDisplayMode.appointment, - showAgenda: false, - navigationDirection: MonthNavigationDirection.horizontal, - monthCellStyle: MonthCellStyle( - textStyle: TextStyle( - fontStyle: FontStyle.normal, - fontSize: 13, - color: Colors.white, - ), - ), - ), - showNavigationArrow: false, - showDatePickerButton: false, - showCurrentTimeIndicator: false, - showWeekNumber: false, - cellBorderColor: Colors.white, - selectionDecoration: BoxDecoration( - border: Border.all(color: MyColors.white, width: 10), - borderRadius: const BorderRadius.all(Radius.circular(100)), - shape: BoxShape.circle, - ), - dataSource: MeetingDataSource(_getDataSource()), - onTap: calendarTapped, ); } - calendarTapped(CalendarTapDetails details) { - dynamic string = getScheduleShiftsDetailsList!.pERCENTAGE; - dynamic percentage = string!.indexOf('%'); - print(percentage); - print(details.date?.day.toString()); - int? index = details.date?.day; + calendarTapped(CalendarTapDetails details) async { + dynamic index = details.date?.day; if (index != null) { index = index - 1; } - getDayHoursTypeDetails(index, getMonth(details.date!.month), details.date?.year); + pRTPID = getDayHoursTypeDetailsList[index].rTPID; + await getScheduleShiftsDetails(index, pRTPID); + dynamic value = getScheduleShiftsDetailsList!.pERCENTAGE; + dynamic percentage; + if (value!.indexOf('%') == 3) { + percentage = int.parse(value!.substring(0, 3)); + } else if (value!.indexOf('%') == 2) { + percentage = int.parse(value!.substring(0, 2)); + } else if (value!.indexOf('%') == 1 && value!.indexOf('%') != 0 && value!.indexOf('%') != "") { + percentage = int.parse(value!.substring(0, 1)); + } else if (value!.indexOf('%') == 0 || value!.indexOf('%') == "") { + percentage = 0; + } showModalBottomSheet( context: context, shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(25)), @@ -499,6 +458,8 @@ class _MonthlyAttendanceState extends State { maxChildSize: 0.9, expand: false, builder: (_, controller) { + dynamic dmyString = getScheduleShiftsDetailsList!.sCHEDULEDATE; + DateTime dateTime1 = DateFormat("MM/dd/yyyy hh:mm:ss a").parse(dmyString); return Column( children: [ Container( @@ -524,11 +485,12 @@ class _MonthlyAttendanceState extends State { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Column(children: [ - "${getScheduleShiftsDetailsList!.sCHEDULEDATE!.substring(0, 9)}".toText24(isBold: true, color: Colors.white), - "Attendance Details".tr().toText16(color: MyColors.lightGreyEFColor), - 21.height, - ]).paddingOnly(top: 25, left: 21, right: 21, bottom: 10), + Container(child: + "${DateFormat("MMMM-dd-yyyy").format(dateTime1).replaceAll('-', " ")}".toText24(isBold: true, color: Colors.white), + ).paddingOnly(top: 26, left: 21, right: 21), + Container( + child: LocaleKeys.attendanceDetails.tr().toText16(color: MyColors.greyACColor).paddingOnly(left: 21,bottom: 16), + ), Center( child: CircularStepProgressBar( totalSteps: 16 * 4, @@ -542,9 +504,9 @@ class _MonthlyAttendanceState extends State { mainAxisSize: MainAxisSize.min, children: [ "${getScheduleShiftsDetailsList!.pERCENTAGE}".toText44(color: Colors.white, isBold: true), - "Completed".tr().toText11(color: MyColors.greyACColor), + LocaleKeys.completed.tr().toText11(color: MyColors.greyACColor), 19.height, - "Shift Time".tr().toText11(color: MyColors.greyACColor), + LocaleKeys.shiftTime.tr().toText11(color: MyColors.greyACColor), "${getScheduleShiftsDetailsList!.sHTNAME}".toText22(color: Colors.white, isBold: true), ], ), @@ -574,11 +536,13 @@ class _MonthlyAttendanceState extends State { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - "Actual Check In ".tr().toText11( + LocaleKeys.actualCheckIn.tr().toText11( color: MyColors.grey67Color, ), 8.height, - "${getScheduleShiftsDetailsList!.sHTACTUALSTARTTIME}".toText22(color: Colors.black, isBold: true), + "${getScheduleShiftsDetailsList!.sHTACTUALSTARTTIME}" !="" + ? "${getScheduleShiftsDetailsList!.sHTACTUALSTARTTIME}".toText22(color: Colors.black, isBold: true) + : "__".toText22(color: Colors.black, isBold: true), ], ), ), @@ -586,11 +550,13 @@ class _MonthlyAttendanceState extends State { Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - "Actual Check Out".tr().toText11( + LocaleKeys.actualCheckOut.tr().toText11( color: MyColors.grey67Color, ), 8.height, - "${getScheduleShiftsDetailsList!.sHTACTUALENDTIME}".toText22(color: Colors.black, isBold: true), + "${getScheduleShiftsDetailsList!.sHTACTUALENDTIME}" != "" + ? "${getScheduleShiftsDetailsList!.sHTACTUALENDTIME}".toText22(color: Colors.black, isBold: true) + : "__".toText22(color: Colors.black, isBold: true), ], ), ], @@ -609,11 +575,13 @@ class _MonthlyAttendanceState extends State { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - "Approved Check In".tr().toText11( + LocaleKeys.approvedCheckIn.tr().toText11( color: MyColors.grey67Color, ), 8.height, - "${getScheduleShiftsDetailsList!.aPPROVEDSTARTTIME}".toText22(color: MyColors.greenColor, isBold: true), + "${getScheduleShiftsDetailsList!.aPPROVEDSTARTTIME}" !="" + ? "${getScheduleShiftsDetailsList!.aPPROVEDSTARTTIME}".toText22(color: MyColors.greenColor, isBold: true) + :"__".toText22(color: MyColors.greenColor, isBold: true), ], ), ), @@ -621,11 +589,13 @@ class _MonthlyAttendanceState extends State { Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - "Approved Check Out".tr().toText11( + LocaleKeys.approvedCheckOut.tr().toText11( color: MyColors.grey67Color, ), 8.height, - "${getScheduleShiftsDetailsList!.aPPROVEDENDTIME}".toText22(color: MyColors.greenColor, isBold: true), + "${getScheduleShiftsDetailsList!.aPPROVEDENDTIME}"!= "" + ? "${getScheduleShiftsDetailsList!.aPPROVEDENDTIME}".toText22(color: MyColors.greenColor, isBold: true) + :"__".toText22(color: MyColors.greenColor, isBold: true), ], ), ], @@ -644,11 +614,11 @@ class _MonthlyAttendanceState extends State { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - "Late In".tr().toText11( + LocaleKeys.lateIn.tr().toText11( color: MyColors.grey67Color, ), 8.height, - "${getDayHoursTypeDetailsList[i].lATEINHRS}".toText22(color: MyColors.redColor, isBold: true), + "${getDayHoursTypeDetailsList[index].lATEINHRS}".toText22(color: MyColors.redColor, isBold: true), ], ), ), @@ -656,11 +626,11 @@ class _MonthlyAttendanceState extends State { Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - "Excess".tr().toText11( + LocaleKeys.excess.tr().toText11( color: MyColors.grey67Color, ), 8.height, - "${getDayHoursTypeDetailsList[i].eXCESSHRS}".toText22(color: Colors.black, isBold: true), + "${getDayHoursTypeDetailsList[index].eXCESSHRS}".toText22(color: Colors.black, isBold: true), ], ), ], @@ -679,11 +649,11 @@ class _MonthlyAttendanceState extends State { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - "Shortage".tr().toText11( + LocaleKeys.shortage.tr().toText11( color: MyColors.grey67Color, ), 8.height, - "${getDayHoursTypeDetailsList[i].sHORTAGEHRS}".toText22(color: Colors.black, isBold: true), + "${getDayHoursTypeDetailsList[index].sHORTAGEHRS}".toText22(color: Colors.black, isBold: true), ], ), ), @@ -691,11 +661,11 @@ class _MonthlyAttendanceState extends State { Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - "Early Out".tr().toText11( + LocaleKeys.earlyOut.tr().toText11( color: MyColors.grey67Color, ), 8.height, - "${getDayHoursTypeDetailsList[i].eARLYOUTHRS}".toText22(color: Colors.black, isBold: true), + "${getDayHoursTypeDetailsList[index].eARLYOUTHRS}".toText22(color: Colors.black, isBold: true), ], ), ], @@ -751,6 +721,35 @@ class _MonthlyAttendanceState extends State { return "December"; } } + + static getMonthAr(int month){ + switch (month) { + case 1: + return 'يناير'; + case 2: + return ' فبراير'; + case 3: + return 'مارس'; + case 4: + return 'أبريل'; + case 5: + return 'مايو'; + case 6: + return 'يونيو'; + case 7: + return 'يوليو'; + case 8: + return 'أغسطس'; + case 9: + return 'سبتمبر'; + case 10: + return ' اكتوبر'; + case 11: + return ' نوفمبر'; + case 12: + return 'ديسمبر'; + } + } } class MeetingDataSource extends CalendarDataSource { diff --git a/lib/ui/my_attendance/my_attendance_screen.dart b/lib/ui/my_attendance/my_attendance_screen.dart index 2b74c98..60a8538 100644 --- a/lib/ui/my_attendance/my_attendance_screen.dart +++ b/lib/ui/my_attendance/my_attendance_screen.dart @@ -26,6 +26,13 @@ class MyAttendanceScreen extends StatelessWidget { height: double.infinity, child: ListView( children: [ + itemView( + "assets/images/pdf.svg", + LocaleKeys.monthlyAttendance.tr(), + ).onPress(() { + Navigator.pushNamed(context, AppRoutes.monthlyAttendance); + }), + 12.height, itemView( "assets/images/pdf.svg", LocaleKeys.missingSwipes.tr(), diff --git a/lib/ui/profile/basic_details.dart b/lib/ui/profile/basic_details.dart index 8a316fd..e74d21d 100644 --- a/lib/ui/profile/basic_details.dart +++ b/lib/ui/profile/basic_details.dart @@ -96,11 +96,7 @@ class _BasicDetailsState extends State { children: [ Container( width: double.infinity, - margin: EdgeInsets.only( - top: 28, - left: 26, - right: 26, - ), + margin: EdgeInsets.only(top: 20, left: 21, right: 21,bottom: 20), padding: EdgeInsets.only(left: 14, right: 14, top: 13, bottom: 5), height: 280, decoration: BoxDecoration( diff --git a/lib/ui/profile/contact_details.dart b/lib/ui/profile/contact_details.dart index ce00b1d..d4927cf 100644 --- a/lib/ui/profile/contact_details.dart +++ b/lib/ui/profile/contact_details.dart @@ -141,7 +141,7 @@ class _ContactDetailsState extends State { right: 26, ), padding: EdgeInsets.only(left: 14, right: 14, top: 5, bottom: 20), - // height: 400, + height: 400, decoration: BoxDecoration( boxShadow: [ BoxShadow( diff --git a/lib/ui/profile/delete_familyMember.dart b/lib/ui/profile/delete_familyMember.dart new file mode 100644 index 0000000..4876ef3 --- /dev/null +++ b/lib/ui/profile/delete_familyMember.dart @@ -0,0 +1,74 @@ + + +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/config/routes.dart'; +import 'package:mohem_flutter_app/dialogs/otp_dialog.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_basic_details.model.dart'; +import 'package:mohem_flutter_app/models/get_employee_contacts.model.dart'; +import 'package:mohem_flutter_app/ui/profile/dynamic_screens/dynamic_input_familyMembers_screen.dart'; +import 'package:mohem_flutter_app/ui/profile/dynamic_screens/dynamic_input_profile_screen.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 DeleteFamilyMember extends StatefulWidget { + const DeleteFamilyMember({Key? key}) : super(key: key); + + @override + _DeleteFamilyMemberState createState() => _DeleteFamilyMemberState(); +} + +class _DeleteFamilyMemberState extends State { + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBarWidget( + context, + title: "Dependents And Beneficiaries", + ), + backgroundColor: MyColors.backgroundColor, + bottomSheet: footer(), + body:Column( + children: [ + + ], + ) + + ); + } + footer() { + return Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Container( + color: MyColors.gradiantEndColor, + // margin: EdgeInsets.only(left: 50,right: 20), + padding: EdgeInsets.only(left: 50,right: 50), + child: TextButton( + style: TextButton.styleFrom( + primary:MyColors.white, + onSurface: MyColors.white, + backgroundColor: MyColors.gradiantEndColor, + ), + onPressed: (){}, + child: Text('Next', + style: TextStyle( + fontStyle: FontStyle.normal, + fontSize: 16, + color: Colors.white, + fontWeight: FontWeight.w600 + ),), + ) + ), + ], + ); + } +} diff --git a/lib/ui/profile/dynamic_screens/dynamic_input_familyMembers_screen.dart b/lib/ui/profile/dynamic_screens/dynamic_input_familyMembers_screen.dart new file mode 100644 index 0000000..0fa6845 --- /dev/null +++ b/lib/ui/profile/dynamic_screens/dynamic_input_familyMembers_screen.dart @@ -0,0 +1,83 @@ + +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/my_attendance_api_client.dart'; +import 'package:mohem_flutter_app/api/profile_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/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/dyanmic_forms/get_set_values_request_model.dart'; +import 'package:mohem_flutter_app/models/generic_response_model.dart'; +import 'package:mohem_flutter_app/models/get_eit_dff_structure_list_model.dart'; +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/profile/basic_details_cols_structions.dart'; +import 'package:mohem_flutter_app/models/profile/basic_details_dff_structure.dart'; +import 'package:mohem_flutter_app/ui/my_attendance/dynamic_screens/dynamic_listview_screen.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 DynamicFamilyMembersParams { + String title; + //String dynamicId; + // String uRL; + // String requestID; + // String colsURL; + List? getEmployeeContactsList; + + DynamicFamilyMembersParams(this.title, + {this.getEmployeeContactsList = const []}); +} + +class DynamicFamilyMembersScreen extends StatefulWidget { + DynamicFamilyMembersScreen({Key? key}) : super(key: key); + + @override + _DynamicFamilyMembersScreenState createState() { + return _DynamicFamilyMembersScreenState(); + } +} + +class _DynamicFamilyMembersScreenState extends State { + // GenericResponseModel? genericResponseModel; + DynamicFamilyMembersParams? dynamicFamilyParams; + + @override + void initState() { + super.initState(); + } + + + @override + void dispose() { + super.dispose(); + } + + @override + Widget build(BuildContext context) { + if(dynamicFamilyParams == null) { + dynamicFamilyParams = ModalRoute.of(context)!.settings.arguments as DynamicFamilyMembersParams; + } + return Scaffold( + backgroundColor: Colors.white, + appBar: AppBarWidget( + context, + title: dynamicFamilyParams!.title, + ), + body: Column( + children: [ + + ], + ), + ); + } + + +} diff --git a/lib/ui/profile/dynamic_screens/dynamic_input_profile_screen.dart b/lib/ui/profile/dynamic_screens/dynamic_input_profile_screen.dart index 6e054c9..3e25917 100644 --- a/lib/ui/profile/dynamic_screens/dynamic_input_profile_screen.dart +++ b/lib/ui/profile/dynamic_screens/dynamic_input_profile_screen.dart @@ -15,6 +15,7 @@ import 'package:mohem_flutter_app/models/dyanmic_forms/get_set_values_request_mo import 'package:mohem_flutter_app/models/generic_response_model.dart'; import 'package:mohem_flutter_app/models/get_eit_dff_structure_list_model.dart'; 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/profile/basic_details_cols_structions.dart'; import 'package:mohem_flutter_app/models/profile/basic_details_dff_structure.dart'; import 'package:mohem_flutter_app/ui/my_attendance/dynamic_screens/dynamic_listview_screen.dart'; @@ -30,6 +31,7 @@ class DynamicProfileParams { String colsURL; List? getEmployeeBasicDetailsList; + DynamicProfileParams(this.title, this.dynamicId, {this.uRL = 'GET_EIT_DFF_STRUCTURE', this.requestID = '', this.colsURL = '', this.getEmployeeBasicDetailsList = const []}); } diff --git a/lib/ui/profile/family_members.dart b/lib/ui/profile/family_members.dart index d62f101..bcc5b32 100644 --- a/lib/ui/profile/family_members.dart +++ b/lib/ui/profile/family_members.dart @@ -8,6 +8,7 @@ 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/config/routes.dart'; import 'package:mohem_flutter_app/dialogs/otp_dialog.dart'; import 'package:mohem_flutter_app/extensions/int_extensions.dart'; import 'package:mohem_flutter_app/extensions/string_extensions.dart'; @@ -15,6 +16,8 @@ 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_basic_details.model.dart'; import 'package:mohem_flutter_app/models/get_employee_contacts.model.dart'; +import 'package:mohem_flutter_app/ui/profile/dynamic_screens/dynamic_input_familyMembers_screen.dart'; +import 'package:mohem_flutter_app/ui/profile/dynamic_screens/dynamic_input_profile_screen.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'; @@ -30,7 +33,7 @@ class _FamilyMembersState extends State { List getEmployeeContactsList = []; - + int? relationId; @override void initState() { super.initState(); @@ -59,146 +62,146 @@ class _FamilyMembersState extends State { ), backgroundColor: MyColors.backgroundColor, bottomSheet:footer(), - body: Column( - children: [ - SizedBox(height: 20,), - getEmployeeContactsList.length != 0 - ? SingleChildScrollView( - child: Column( - children: [ - ListView.builder( - scrollDirection: Axis.vertical, - shrinkWrap: true, - physics: ScrollPhysics(), - itemCount: getEmployeeContactsList.length, - itemBuilder: (context, index) { - return Container( - child: Column( - children: [ - Container( - width: double.infinity, - margin: EdgeInsets.only(top: 10, left: 26, right: 26,), - padding: EdgeInsets.only(left: 14, right: 14,top: 13, ), - height: 110, - 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: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - "${getEmployeeContactsList[index].cONTACTNAME}".toText16(color: MyColors.blackColor), - "${getEmployeeContactsList[index].rELATIONSHIP}".toText11(isBold: true, color: MyColors.textMixColor), - SizedBox(height: 5,), - Divider( - color: MyColors.lightGreyEFColor, - height: 20, - thickness: 1, - indent: 0, - endIndent: 0, + body: Container( + width: MediaQuery.of(context).size.width, + child: getEmployeeContactsList.length != 0 + ? SingleChildScrollView( + scrollDirection: Axis.vertical, + child: Column( + children: [ + ListView.builder( + scrollDirection: Axis.vertical, + shrinkWrap: true, + physics: ScrollPhysics(), + itemCount: getEmployeeContactsList.length, + itemBuilder: (context, index) { + return Container( + child: Column( + children: [ + Container( + width: double.infinity, + margin: EdgeInsets.only(top: 20, left: 21, right: 21,), + padding: EdgeInsets.only(left: 14, right: 14,top: 13, ), + height: 110, + decoration: BoxDecoration( + boxShadow: [ + BoxShadow( + color: Colors.grey.withOpacity(0.5), + spreadRadius: 5, + blurRadius: 26, + offset: Offset(0, 3), ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - children: [ - Container( - child: InkWell( - onTap: () { - - }, - child: RichText( - text: TextSpan( - children: [ - WidgetSpan( - child: Icon( - Icons.edit, - size: 15, - color: MyColors.grey67Color, + ], + color: Colors.white, + borderRadius: BorderRadius.circular(10.0), + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + "${getEmployeeContactsList[index].cONTACTNAME}".toText16(color: MyColors.blackColor), + "${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: InkWell( + onTap: () { + showUpdateAlertDialog(context); + }, + child: RichText( + text: TextSpan( + children: [ + WidgetSpan( + child: Icon( + Icons.edit, + size: 15, + color: MyColors.grey67Color, + ), ), - ), - TextSpan( - text: LocaleKeys.update.tr(), - style: TextStyle( - color: MyColors.grey67Color, - fontSize: 12, - fontWeight: FontWeight.bold, + TextSpan( + text: LocaleKeys.update.tr(), + style: TextStyle( + color: MyColors.grey67Color, + fontSize: 12, + fontWeight: FontWeight.bold, + ), ), - ), - ], + ], + ), ), + ) + ), + Padding( + padding: const EdgeInsets.symmetric(horizontal: 8), + child: SizedBox( + child: Container( + width: 3, + color: MyColors.lightGreyEFColor, ), - ) - ), - Padding( - padding: const EdgeInsets.symmetric(horizontal: 8), - child: SizedBox( - child: Container( - width: 3, - color: MyColors.lightGreyEFColor, ), ), - ), - Container( - child: InkWell( - onTap: () { - showAlertDialog(context); - }, - child: RichText( - text: TextSpan( - children: [ - WidgetSpan( - child: Icon( - Icons.delete, - size: 15, - color: Color(0x99FF0000), + Container( + child: InkWell( + onTap: () { + showRemoveAlertDialog(context, getEmployeeContactsList[index]!.cONTACTRELATIONSHIPID!.toInt()); + }, + child: RichText( + text: TextSpan( + children: [ + WidgetSpan( + child: Icon( + Icons.delete, + size: 15, + color: Color(0x99FF0000), + ), ), - ), - TextSpan( - text:LocaleKeys.remove.tr(), - style: TextStyle( - color: MyColors.DarkRedColor, - fontSize: 12, - fontWeight: FontWeight.bold, + TextSpan( + text:LocaleKeys.remove.tr(), + style: TextStyle( + color: MyColors.DarkRedColor, + fontSize: 12, + fontWeight: FontWeight.bold, + ), ), - ), - ], + ], + ), ), - ), - ) - ), - // ElevatedButton.icon( - // icon: Icon( - // Icons.delete, - // size: 15, - // color: Color(0x99FF0000), - // ), - // style: ElevatedButton.styleFrom( - // shadowColor: Colors.white, - // primary: Colors.white, - // ), - // label: "remove".toText12(color: MyColors.DarkRedColor), - // onPressed: (){}, - // ), - ], - ), - ] + ) + ), + // ElevatedButton.icon( + // icon: Icon( + // Icons.delete, + // size: 15, + // color: Color(0x99FF0000), + // ), + // style: ElevatedButton.styleFrom( + // shadowColor: Colors.white, + // primary: Colors.white, + // ), + // label: "remove".toText12(color: MyColors.DarkRedColor), + // onPressed: (){}, + // ), + ], + ), + ] + ), ), - ), - ], - ) - ); - }) + ], + ) + ); + }) ], ), - ):Container(), - ], + ):Container(), + // SizedBox(height: 20), ) @@ -214,26 +217,57 @@ class _FamilyMembersState extends State { BoxShadow(color: MyColors.lightGreyEFColor, spreadRadius: 3), ], ), - child: DefaultButton(LocaleKeys.update.tr(), () async { + child: DefaultButton("Add New Family Member", () async { // context.setLocale(const Locale("en", "US")); // to change Loacle Profile(); }).insideContainer, ); } - showAlertDialog(BuildContext context) { + showUpdateAlertDialog(BuildContext context) { Widget cancelButton = TextButton( - child: Text("CANCEL"), + child: Text(LocaleKeys.cancel.tr(),), onPressed: () { Navigator.pop(context); }, ); Widget continueButton = TextButton( - child: Text("OK"), - onPressed: () {}, + child: Text(LocaleKeys.ok.tr(),), + onPressed: () { + continueDynamicForms(); + }, ); AlertDialog alert = AlertDialog( - title: Text("Confirm"), + title: Text(LocaleKeys.confirm.tr(),), + content: Text("Are You Sure You Want to Update this Member?"), + actions: [ + cancelButton, + continueButton, + ], + ); + showDialog( + context: context, + builder: (BuildContext context) { + return alert; + }, + ); + } + showRemoveAlertDialog(BuildContext context,int relationId) { + Widget cancelButton = TextButton( + child: Text(LocaleKeys.cancel.tr(),), + onPressed: () { + Navigator.pop(context); + }, + ); + Widget continueButton = TextButton( + child: Text(LocaleKeys.ok.tr(),), + onPressed: () { + Navigator.pushNamed(context, AppRoutes.deleteFamilyMember); + // continueDynamicForms(); + }, + ); + AlertDialog alert = AlertDialog( + title: Text(LocaleKeys.confirm.tr(),), content: Text("Are You Sure You Want to Remove this Member?"), actions: [ cancelButton, @@ -248,4 +282,10 @@ class _FamilyMembersState extends State { ); } + + void continueDynamicForms() { + Navigator.pushNamed(context, AppRoutes.addDynamicInputProfile, + arguments: DynamicFamilyMembersParams(LocaleKeys.profile_familyDetails.tr(), getEmployeeContactsList: getEmployeeContactsList)); + } + } diff --git a/pubspec.yaml b/pubspec.yaml index 03cfb99..6162d99 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -62,13 +62,11 @@ dependencies: geolocator: any # flutter_compass: ^0.6.1 google_maps_flutter_web: ^0.3.2 + month_year_picker: ^0.2.0+1 + month_picker_dialog: ^0.4.0 open_file: ^3.2.1 wifi_iot: ^0.3.16 - - - - dev_dependencies: flutter_test: sdk: flutter