diff --git a/assets/icons/chat/chat.svg b/assets/icons/chat/chat.svg index 29d4471..bf8977d 100644 --- a/assets/icons/chat/chat.svg +++ b/assets/icons/chat/chat.svg @@ -1,23 +1,13 @@ - - - - - + + + + + - - - - - - - - - - - - - + + + diff --git a/assets/icons/create_req.svg b/assets/icons/create_req.svg index a87e809..76f414f 100644 --- a/assets/icons/create_req.svg +++ b/assets/icons/create_req.svg @@ -1,7 +1,5 @@ - - - - - - + + + + diff --git a/assets/icons/home.svg b/assets/icons/home.svg index fb67997..91992ad 100644 --- a/assets/icons/home.svg +++ b/assets/icons/home.svg @@ -1,7 +1,7 @@ - - - - + + + + diff --git a/assets/icons/item_for_sale.svg b/assets/icons/item_for_sale.svg index 0a87567..a908b3f 100644 --- a/assets/icons/item_for_sale.svg +++ b/assets/icons/item_for_sale.svg @@ -1,3 +1,11 @@ - - + + + + + + + + + + diff --git a/assets/icons/work_list.svg b/assets/icons/work_list.svg index a802c53..becb368 100644 --- a/assets/icons/work_list.svg +++ b/assets/icons/work_list.svg @@ -1,15 +1,6 @@ - - - - - - - - - - - - - + + + + diff --git a/lib/classes/date_uitl.dart b/lib/classes/date_uitl.dart index 29edb2f..ec5358d 100644 --- a/lib/classes/date_uitl.dart +++ b/lib/classes/date_uitl.dart @@ -6,7 +6,6 @@ class DateUtil { /// /// - static DateTime convertStringToDateMarathon(String date) { // /Date(1585774800000+0300)/ if (date != null) { @@ -40,7 +39,30 @@ class DateUtil { } static DateTime convertSimpleStringDateToDate(String date) { - return DateFormat("MM/dd/yyyy hh:mm:ss a").parse(date.toUpperCase()); + // print(date.toUpperCase()); + return getDateTimeFromString(date.split(" ")[0], date.toUpperCase().split(" ")[1] + " " + date.toUpperCase().split(" ")[2]); + } + + static DateTime getDateTimeFromString(String date, String time) { + var hours = num.parse(time.split(":")[0]); + var mins = time.split(":")[1]; + var secs = time.split(":")[2].split(" ")[0]; + + String meridium = time.split(" ")[1]; + if (meridium == "PM") { + if (hours != 12) { + hours = hours + 12; + } + } + if (meridium == "AM") { + if (hours == 12) { + hours = 00; + } + } + date = date + " $hours:$mins:$secs"; + DateTime returnDate = DateFormat("MM/dd/yyyy HH:mm:ss").parse(date); + + return returnDate; } static DateTime convertSimpleStringDateToDateddMMyyyy(String date) { diff --git a/lib/classes/utils.dart b/lib/classes/utils.dart index 57bb888..572c09e 100644 --- a/lib/classes/utils.dart +++ b/lib/classes/utils.dart @@ -310,7 +310,18 @@ class Utils { } static String formatDateDefault(String date) { - return DateFormat('yyyy-MM-dd').format(DateFormat('dd-MMM-yyyy').parseLoose(date)); + if (date.toLowerCase().contains("t")) { + date = date.toLowerCase().split("t")[0]; + // return DateFormat('yyyy-MM-dd').format(DateFormat('dd-MM-yyyy').parseLoose(date)); + return DateFormat('dd-MM-yyyy').format(DateFormat('yyyy-MM-dd').parseLoose(date)); + } else { + if(date.toLowerCase().split("-")[1].length == 3) { + return DateFormat('dd-MM-yyyy').format(DateFormat('dd-MMM-yyyy').parseLoose(date)); + } else { + return DateFormat('dd-MM-yyyy').format(DateFormat('yyyy-MM-dd').parseLoose(date)); + } + // return DateFormat('yyyy-MM-dd').format(DateFormat('dd-MM-yyyy').parseLoose(date)); + } } static Future selectDate(BuildContext context, DateTime selectedDate) async { diff --git a/lib/ui/marathon/widgets/marathon_banner.dart b/lib/ui/marathon/widgets/marathon_banner.dart index 1b5533b..29c4fd3 100644 --- a/lib/ui/marathon/widgets/marathon_banner.dart +++ b/lib/ui/marathon/widgets/marathon_banner.dart @@ -184,202 +184,200 @@ class MarathonBanner extends StatelessWidget { Widget build(BuildContext context) { MarathonProvider provider = context.read(); - return - // !provider.isPrivilegedWithMarathon - // ? getUnPrivilegedMarathon(context) - // : provider.marathonDetailModel.startTime != null - // ? - Container( - decoration: MyDecorations.shadowDecoration, - height: isTablet ? MediaQuery.of(context).size.height * 0.17 : MediaQuery.of(context).size.height * 0.11, - clipBehavior: Clip.antiAlias, - child: Stack( - children: [ - Transform( - alignment: Alignment.center, - transform: Matrix4.rotationY( - AppState().isArabic(context) ? math.pi : 0, - ), - child: SvgPicture.asset( - "assets/images/marathon_banner_bg.svg", - fit: BoxFit.fill, - width: double.infinity, - ), - ), - AppState().isArabic(context) - ? Positioned( - right: -15, - top: -10, - child: Transform.rotate( - angle: 10, - child: Container( - width: isTablet ? 70 : 65, - height: isTablet ? 40 : 32, - color: MyColors.darkDigitColor, - ), - ), - ) - : Positioned( - left: -20, - top: -10, - child: Transform.rotate( - angle: 15, - child: Container( - width: isTablet ? 70 : 65, - height: isTablet ? 40 : 32, - color: MyColors.darkDigitColor, + return provider.isPrivilegedWithMarathon + ? getUnPrivilegedMarathon(context) + : provider.marathonDetailModel.startTime != null + ? Container( + decoration: MyDecorations.shadowDecoration, + height: isTablet ? MediaQuery.of(context).size.height * 0.17 : MediaQuery.of(context).size.height * 0.11, + clipBehavior: Clip.antiAlias, + child: Stack( + children: [ + Transform( + alignment: Alignment.center, + transform: Matrix4.rotationY( + AppState().isArabic(context) ? math.pi : 0, + ), + child: SvgPicture.asset( + "assets/images/marathon_banner_bg.svg", + fit: BoxFit.fill, + width: double.infinity, + ), ), - ), - ), - SizedBox( - width: double.infinity, - height: double.infinity, - child: Row( - children: [ - const Expanded( - flex: 3, - child: SizedBox( - width: double.infinity, - height: double.infinity, - ), - ), - Expanded( - flex: AppState().isArabic(context) ? 4 : 5, - child: SizedBox( - width: double.infinity, - height: double.infinity, - child: Row( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - Column( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisSize: MainAxisSize.min, - children: [ - AppState().isArabic(context) ? 0.height : 5.height, - Text( - LocaleKeys.getReadyForContest.tr(), - style: TextStyle( - fontSize: isTablet ? 20 : 11, - fontStyle: FontStyle.italic, - fontWeight: FontWeight.w600, - color: MyColors.white.withOpacity(0.83), - letterSpacing: -0.4, + AppState().isArabic(context) + ? Positioned( + right: -15, + top: -10, + child: Transform.rotate( + angle: 10, + child: Container( + width: isTablet ? 70 : 65, + height: isTablet ? 40 : 32, + color: MyColors.darkDigitColor, ), ), - Text( - AppState().isArabic(context) ? provider.marathonDetailModel.titleAr ?? "" : provider.marathonDetailModel.titleEn ?? "", - style: TextStyle( - fontStyle: FontStyle.italic, - fontSize: isTablet ? 30 : 19, - fontWeight: FontWeight.bold, - color: MyColors.white.withOpacity(0.83), - height: 32 / 22, + ) + : Positioned( + left: -20, + top: -10, + child: Transform.rotate( + angle: 15, + child: Container( + width: isTablet ? 70 : 65, + height: isTablet ? 40 : 32, + color: MyColors.darkDigitColor, ), ), - isTablet ? 10.height : 3.height, - BuildCountdownTimer( - timeToMarathon: DateTime.parse(provider.marathonDetailModel.startTime!).millisecondsSinceEpoch, - provider: provider, - screenFlag: 0, + ), + SizedBox( + width: double.infinity, + height: double.infinity, + child: Row( + children: [ + const Expanded( + flex: 3, + child: SizedBox( + width: double.infinity, + height: double.infinity, ), - ], - ).paddingOnly( - left: AppState().isArabic(context) ? 12 : 3, - right: AppState().isArabic(context) ? 3 : 12, - ) - ], - ), - ), - ), - ], - ), - ), - AppState().isArabic(context) - ? Align( - alignment: Alignment.topRight, - child: SizedBox( - height: isTablet ? 30 : 20, - width: isTablet ? 45 : 35, - child: Transform.rotate( - angle: math.pi / 4.5, - child: Text( - LocaleKeys.brainMarathon.tr(), - textAlign: TextAlign.center, - maxLines: 2, - style: TextStyle( - color: MyColors.white, - fontWeight: FontWeight.bold, - fontSize: isTablet ? 8 : 6, - height: 1.2, - ), - ), - ), - ), - ).paddingOnly(top: 5) - : Align( - alignment: Alignment.topLeft, - child: SizedBox( - height: isTablet ? 30 : 20, - width: isTablet ? 45 : 35, - child: Transform.rotate( - angle: -math.pi / 4.5, - child: Text( - LocaleKeys.brainMarathon.tr(), - textAlign: TextAlign.center, - maxLines: 2, - style: TextStyle( - color: MyColors.kWhiteColor, - fontWeight: FontWeight.bold, - fontSize: isTablet ? 8 : 6, - height: 1.2, - ), + ), + Expanded( + flex: AppState().isArabic(context) ? 4 : 5, + child: SizedBox( + width: double.infinity, + height: double.infinity, + child: Row( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + AppState().isArabic(context) ? 0.height : 5.height, + Text( + LocaleKeys.getReadyForContest.tr(), + style: TextStyle( + fontSize: isTablet ? 20 : 11, + fontStyle: FontStyle.italic, + fontWeight: FontWeight.w600, + color: MyColors.white.withOpacity(0.83), + letterSpacing: -0.4, + ), + ), + Text( + AppState().isArabic(context) ? provider.marathonDetailModel.titleAr ?? "" : provider.marathonDetailModel.titleEn ?? "", + style: TextStyle( + fontStyle: FontStyle.italic, + fontSize: isTablet ? 30 : 19, + fontWeight: FontWeight.bold, + color: MyColors.white.withOpacity(0.83), + height: 32 / 22, + ), + ), + isTablet ? 10.height : 3.height, + BuildCountdownTimer( + timeToMarathon: DateTime.parse(provider.marathonDetailModel.startTime!).millisecondsSinceEpoch, + provider: provider, + screenFlag: 0, + ), + ], + ).paddingOnly( + left: AppState().isArabic(context) ? 12 : 3, + right: AppState().isArabic(context) ? 3 : 12, + ) + ], + ), + ), + ), + ], ), ), - ), - ).paddingOnly(top: 5), - !AppState().isArabic(context) - ? Positioned( - right: 0, - bottom: 0, - child: RotatedBox( - quarterTurns: 4, - child: SvgPicture.asset("assets/images/arrow_next.svg", color: MyColors.whiteColor), - ).paddingAll(isTablet ? 20 : 15), - ) - : Positioned( - bottom: 0, - left: 0, - child: RotatedBox( - quarterTurns: 2, - child: SvgPicture.asset("assets/images/arrow_next.svg", color: MyColors.whiteColor), - ).paddingAll(isTablet ? 20 : 15), - ), - ], - ).onPress(() async { - int remainingTimeInMinutes = DateTime.parse(provider.marathonDetailModel.startTime!).difference(DateTime.now()).inMinutes; + AppState().isArabic(context) + ? Align( + alignment: Alignment.topRight, + child: SizedBox( + height: isTablet ? 30 : 20, + width: isTablet ? 45 : 35, + child: Transform.rotate( + angle: math.pi / 4.5, + child: Text( + LocaleKeys.brainMarathon.tr(), + textAlign: TextAlign.center, + maxLines: 2, + style: TextStyle( + color: MyColors.white, + fontWeight: FontWeight.bold, + fontSize: isTablet ? 8 : 6, + height: 1.2, + ), + ), + ), + ), + ).paddingOnly(top: 5) + : Align( + alignment: Alignment.topLeft, + child: SizedBox( + height: isTablet ? 30 : 20, + width: isTablet ? 45 : 35, + child: Transform.rotate( + angle: -math.pi / 4.5, + child: Text( + LocaleKeys.brainMarathon.tr(), + textAlign: TextAlign.center, + maxLines: 2, + style: TextStyle( + color: MyColors.kWhiteColor, + fontWeight: FontWeight.bold, + fontSize: isTablet ? 8 : 6, + height: 1.2, + ), + ), + ), + ), + ).paddingOnly(top: 5), + !AppState().isArabic(context) + ? Positioned( + right: 0, + bottom: 0, + child: RotatedBox( + quarterTurns: 4, + child: SvgPicture.asset("assets/images/arrow_next.svg", color: MyColors.whiteColor), + ).paddingAll(isTablet ? 20 : 15), + ) + : Positioned( + bottom: 0, + left: 0, + child: RotatedBox( + quarterTurns: 2, + child: SvgPicture.asset("assets/images/arrow_next.svg", color: MyColors.whiteColor), + ).paddingAll(isTablet ? 20 : 15), + ), + ], + ).onPress(() async { + int remainingTimeInMinutes = DateTime.parse(provider.marathonDetailModel.startTime!).difference(DateTime.now()).inMinutes; - if (remainingTimeInMinutes > 2) { - Utils.showLoading(context); - try { - await provider.initializeVideoPlayer().then((_) { - Utils.hideLoading(context); - provider.startTimerForSponsorVideo(); - Navigator.pushNamed(context, AppRoutes.marathonSponsorVideoScreen); - }); - } catch (e) { - if (kDebugMode) { - print("Error in VideoPlayer: ${e.toString()}"); - } - Utils.hideLoading(context); - Navigator.pushNamed(context, AppRoutes.marathonIntroScreen); - } - } else { - Navigator.pushNamed(context, AppRoutes.marathonIntroScreen); - } - }), - ); - // ) - // : const SizedBox(); + if (remainingTimeInMinutes > 2) { + Utils.showLoading(context); + try { + await provider.initializeVideoPlayer().then((_) { + Utils.hideLoading(context); + provider.startTimerForSponsorVideo(); + Navigator.pushNamed(context, AppRoutes.marathonSponsorVideoScreen); + }); + } catch (e) { + if (kDebugMode) { + print("Error in VideoPlayer: ${e.toString()}"); + } + Utils.hideLoading(context); + Navigator.pushNamed(context, AppRoutes.marathonIntroScreen); + } + } else { + Navigator.pushNamed(context, AppRoutes.marathonIntroScreen); + } + }), + // ); + ) + : const SizedBox(); } } diff --git a/lib/ui/my_attendance/dynamic_screens/dynamic_input_screen.dart b/lib/ui/my_attendance/dynamic_screens/dynamic_input_screen.dart index fe7a6f3..a94a6e2 100644 --- a/lib/ui/my_attendance/dynamic_screens/dynamic_input_screen.dart +++ b/lib/ui/my_attendance/dynamic_screens/dynamic_input_screen.dart @@ -188,7 +188,7 @@ class _DynamicInputScreenState extends State { // Utils.hideLoading(context); } } else if (values.isNotEmpty) { - ESERVICESDV defaultValue = await MyAttendanceApiClient().getDefaultValue(segmentId, structureList.dESCFLEXCONTEXTCODE!, structureList.dESCFLEXNAME!, values); + ESERVICESDV defaultValue = await MyAttendanceApiClient().getDefaultValue(segmentId, structureList.dESCFLEXCONTEXTCODE!, structureList.dESCFLEXNAME!, values, empID: dynamicParams!.selectedEmp); int index = getEitDffStructureList!.indexWhere((element) => element.sEGMENTNAME == segmentId); getEitDffStructureList![index].eSERVICESDV = defaultValue; } diff --git a/lib/ui/my_attendance/services_menu_list_screen.dart b/lib/ui/my_attendance/services_menu_list_screen.dart index 097a63a..8e44324 100644 --- a/lib/ui/my_attendance/services_menu_list_screen.dart +++ b/lib/ui/my_attendance/services_menu_list_screen.dart @@ -19,6 +19,7 @@ class ServicesMenuListScreenParams { final List list; final String? selectedEmp; GetEmployeeSubordinatesList? getEmployeeSubordinates; + ServicesMenuListScreenParams(this.title, this.list, {this.selectedEmp}); } diff --git a/lib/ui/my_team/create_request.dart b/lib/ui/my_team/create_request.dart index 94ac415..b77ac30 100644 --- a/lib/ui/my_team/create_request.dart +++ b/lib/ui/my_team/create_request.dart @@ -38,13 +38,13 @@ class _CreateRequestState extends State { @override void initState() { super.initState(); - employeeSubRequest(); + // employeeSubRequest(); } void employeeSubRequest() async { try { Utils.showLoading(context); - getEmployeeSubordinatesList = await MyTeamApiClient().getEmployeeSubordinates(searchEmpEmail.toString(), searchEmpName.toString(), searchEmpNo.toString()); + // getEmployeeSubordinatesList = await MyTeamApiClient().getEmployeeSubordinates(searchEmpEmail.toString(), searchEmpName.toString(), searchEmpNo.toString()); getMenuEntriesList = await MyTeamApiClient().employeeSubordinatesRequest(getEmployeeSubordinates?.eMPLOYEENUMBER); homeMenus = parseMenus(getMenuEntriesList); Utils.hideLoading(context); @@ -80,8 +80,10 @@ class _CreateRequestState extends State { @override Widget build(BuildContext context) { - getEmployeeSubordinates ??= ModalRoute.of(context)?.settings.arguments as GetEmployeeSubordinatesList; - + if (getEmployeeSubordinates == null) { + getEmployeeSubordinates ??= ModalRoute.of(context)?.settings.arguments as GetEmployeeSubordinatesList; + employeeSubRequest(); + } return Scaffold( backgroundColor: Colors.white, appBar: AppBarWidget( diff --git a/lib/ui/my_team/employee_details.dart b/lib/ui/my_team/employee_details.dart index 1412641..e78c304 100644 --- a/lib/ui/my_team/employee_details.dart +++ b/lib/ui/my_team/employee_details.dart @@ -74,12 +74,12 @@ class _EmployeeDetailsState extends State { getEmployeeSubordinates!.eMPLOYEEIMAGE != null ? Container( height: 200, - margin: EdgeInsets.only(top: 30), + margin: const EdgeInsets.only(top: 30), decoration: BoxDecoration(image: DecorationImage(image: MemoryImage(Utils.dataFromBase64String(getEmployeeSubordinates!.eMPLOYEEIMAGE!)), fit: BoxFit.cover)), - child: new BackdropFilter( - filter: new ImageFilter.blur(sigmaX: 10.0, sigmaY: 10.0), - child: new Container( - decoration: new BoxDecoration(color: Colors.white.withOpacity(0.0)), + child: BackdropFilter( + filter: ImageFilter.blur(sigmaX: 10.0, sigmaY: 10.0), + child: Container( + decoration: BoxDecoration(color: Colors.white.withOpacity(0.0)), ), ), ) diff --git a/lib/ui/my_team/team_members.dart b/lib/ui/my_team/team_members.dart index c4defc4..8847c36 100644 --- a/lib/ui/my_team/team_members.dart +++ b/lib/ui/my_team/team_members.dart @@ -33,13 +33,13 @@ class _TeamMembersState extends State { void initState() { super.initState(); - employeeSubordinates(); + // employeeSubordinates(); } void employeeSubordinates() async { try { Utils.showLoading(context); - getEmployeeSubordinatesList = await MyTeamApiClient().getEmployeeSubordinates(searchEmpEmail.toString(), searchEmpName.toString(), searchEmpNo.toString()); + // 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(() {}); @@ -51,7 +51,10 @@ class _TeamMembersState extends State { @override Widget build(BuildContext context) { - getEmployeeSubordinates ??= ModalRoute.of(context)?.settings.arguments as GetEmployeeSubordinatesList; + if (getEmployeeSubordinates == null) { + getEmployeeSubordinates ??= ModalRoute.of(context)?.settings.arguments as GetEmployeeSubordinatesList; + employeeSubordinates(); + } return Scaffold( appBar: AppBarWidget( context, diff --git a/lib/ui/screens/items_for_sale/fragments/my_posted_ads_fragment.dart b/lib/ui/screens/items_for_sale/fragments/my_posted_ads_fragment.dart index 64b8bf9..02db148 100644 --- a/lib/ui/screens/items_for_sale/fragments/my_posted_ads_fragment.dart +++ b/lib/ui/screens/items_for_sale/fragments/my_posted_ads_fragment.dart @@ -141,7 +141,7 @@ class _MyPostedAdsFragmentState extends State { Row( children: [ LocaleKeys.remove.tr().toText12(color: MyColors.redColor).center.onPress(() { - updateItemForSale(employeePostedAdsList[index].itemSaleID!); + updateItemForSale(employeePostedAdsList[index]); }).expanded, Container(width: 1, height: 30, color: MyColors.lightGreyEFColor), LocaleKeys.edit.tr().toText12(color: MyColors.gradiantEndColor).center.onPress(() { @@ -172,7 +172,7 @@ class _MyPostedAdsFragmentState extends State { ); } - void updateItemForSale(int itemSaleID) async { + void updateItemForSale(EmployeePostedAds employeePostedAds) async { Utils.showLoading(context); String? empNum = AppState().memberInformationList?.eMPLOYEENUMBER; @@ -180,15 +180,24 @@ class _MyPostedAdsFragmentState extends State { String? loginTokenID = AppState().postParamsObject?.logInTokenID; String? tokenID = AppState().postParamsObject?.tokenID; - var request = http.MultipartRequest('POST', Uri.parse("${ApiConsts.cocRest}Mohemm_ITG_UpdateItemForSale")); - request.fields['itemSaleID'] = itemSaleID.toString(); + var request = http.MultipartRequest('POST', Uri.parse("${ApiConsts.cocRest}Mohemm_ITG_UpdateItemForSaleMobile")); + request.fields['ItgItemSaleID'] = employeePostedAds.itemSaleID.toString(); + request.fields['ItgCategoryID'] = employeePostedAds.categoryID.toString(); + request.fields['ItgTitle'] = employeePostedAds.title!; + request.fields['ItgDescription'] = employeePostedAds.description!; + request.fields['ItgQuotePrice'] = employeePostedAds.quotePrice.toString(); + request.fields['RegionID'] = employeePostedAds.regionID.toString(); + request.fields['Itg_EndDate'] = employeePostedAds.endDate.toString(); request.fields['Channel'] = "31"; - request.fields['isActive'] = "false"; + request.fields['ItgIsActive'] = "false"; request.fields['LogInToken'] = loginTokenID!; request.fields['Token'] = tokenID!; request.fields['MobileNo'] = empMobNum!; request.fields['EmployeeNumber'] = empNum!; request.fields['employeeNumber'] = empNum; + + // debugPrint(json.encode(request.fields.toString())); + var response = await request.send().catchError((e) { Utils.hideLoading(context); Utils.handleException(e, context, null); diff --git a/pubspec.yaml b/pubspec.yaml index c0b77bb..2f3fffa 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -94,7 +94,7 @@ dependencies: camera: ^0.10.0+4 #Chat Voice Message Recoding & Play - record: ^4.4.3 +# record: ^4.4.3 audio_waveforms: ^0.1.5+1 # animated_text_kit: ^4.2.2