diff --git a/lib/api/worklist/worklist_api_client.dart b/lib/api/worklist/worklist_api_client.dart index 626ac6a..1adfe29 100644 --- a/lib/api/worklist/worklist_api_client.dart +++ b/lib/api/worklist/worklist_api_client.dart @@ -846,4 +846,19 @@ class WorkListApiClient { postParams, ); } + + + Future?> getFADisposalNtfDetails(int? notificationId) async { + String url = "${ApiConsts.erpRest}GET_PAY_REQ_NOTIFICATION_BODY"; + Map postParams = {"P_NOTIFICATION_ID": notificationId, "P_PAGE_LIMIT": 100, "P_PAGE_NUM": 1}; + postParams.addAll(AppState().postParamsJson); + return await ApiClient().postJsonForObject( + (json) { + GenericResponseModel responseData = GenericResponseModel.fromJson(json); + return responseData.getAbsenceCollectionNotificationBodyList; + }, + url, + postParams, + ); + } } diff --git a/lib/classes/consts.dart b/lib/classes/consts.dart index 0f939bf..6b43bbd 100644 --- a/lib/classes/consts.dart +++ b/lib/classes/consts.dart @@ -11,11 +11,11 @@ class ApiConsts { // static String baseUrl = "https://mohemm.hmg.com"; // New Live server // - static String baseUrl = "https://uat.hmgwebservices.com"; // UAT ser343622ver + // static String baseUrl = "https://uat.hmgwebservices.com"; // UAT ser343622ver // static String baseUrl = "http://10.20.200.111:1010/"; // static String baseUrl = "https://webservices.hmg.com"; // PreProd - // static String baseUrl = "https://mohemm.hmg.com"; + static String baseUrl = "https://mohemm.hmg.com"; // static String baseUrl = "https://hmgwebservices.com"; // Live server static String baseUrlServices = baseUrl + "/Services/"; // server diff --git a/lib/extensions/string_extensions.dart b/lib/extensions/string_extensions.dart index 91ded82..93a6cf8 100644 --- a/lib/extensions/string_extensions.dart +++ b/lib/extensions/string_extensions.dart @@ -81,28 +81,30 @@ extension EmailValidator on String { ), ); - Widget toText12({Color? color, bool isUnderLine = false, bool isBold = false, bool isCenter = false, int maxLine = 0}) => Text( + Widget toText12({Color? color, bool isUnderLine = false, bool isBold = false, bool isCenter = false, int? maxLine, TextOverflow? overflow}) => Text( this, textAlign: isCenter ? TextAlign.center : null, - maxLines: (maxLine > 0) ? maxLine : null, + maxLines: maxLine == 0 ? null : maxLine, style: TextStyle( fontSize: 12, fontWeight: isBold ? FontWeight.bold : FontWeight.w600, color: color ?? MyColors.darkTextColor, letterSpacing: -0.72, decoration: isUnderLine ? TextDecoration.underline : null, + overflow: TextOverflow.visible ), ); - Widget toText12Auto({Color? color, bool isUnderLine = false, bool isBold = false, bool isCenter = false, int maxLine = 0}) => AutoSizeText( + Widget toText12Auto({Color? color, bool isUnderLine = false, bool isBold = false, bool isCenter = false, int? maxLine,TextOverflow? overflow}) => AutoSizeText( this, textAlign: isCenter ? TextAlign.center : null, - maxLines: (maxLine > 0) ? maxLine : null, + maxLines: maxLine == 0 ? null : maxLine, minFontSize: 8, style: TextStyle( fontSize: 12, fontWeight: isBold ? FontWeight.bold : FontWeight.w600, color: color ?? MyColors.darkTextColor, + overflow: overflow, letterSpacing: -0.72, decoration: isUnderLine ? TextDecoration.underline : null, ), diff --git a/lib/generated/codegen_loader.g.dart b/lib/generated/codegen_loader.g.dart index f3fda6a..f4c247c 100644 --- a/lib/generated/codegen_loader.g.dart +++ b/lib/generated/codegen_loader.g.dart @@ -633,7 +633,9 @@ class CodegenLoader extends AssetLoader{ "mazaya": "مازيا", "benefits": "فوائد", "mazayaDesc": "اكتشف الخصومات والعروض الخاصة المتاحة للموظفين", - "viewallofferMazaya": "أعرض كل المزايا" + "viewallofferMazaya": "أعرض كل المزايا", + "faDisposalRequest":"طلب التخلص من FA", + "showMore": "إظهار المزيد" }; static const Map _en_US = { "mohemm": "Mohemm", @@ -1254,7 +1256,9 @@ static const Map _en_US = { "mazaya": "MAZAYA", "benefits": "Benefits", "mazayaDesc": "Discover special Discounts and offers available to Employees", - "viewallofferMazaya": "View All Offers" + "viewallofferMazaya": "View All Offers", + "faDisposalRequest":"FA Disposal Request", + "showMore":"Show More" }; static const Map> mapLocales = {"ar_SA": _ar_SA, "en_US": _en_US}; } diff --git a/lib/generated/locale_keys.g.dart b/lib/generated/locale_keys.g.dart index b748380..5abf026 100644 --- a/lib/generated/locale_keys.g.dart +++ b/lib/generated/locale_keys.g.dart @@ -606,5 +606,6 @@ abstract class LocaleKeys { static const benefits = 'benefits'; static const mazayaDesc = 'mazayaDesc'; static const viewallofferMazaya = 'viewallofferMazaya'; - + static const faRequest = 'faDisposalRequest'; + static const showMore = 'showMore'; } diff --git a/lib/ui/work_list/work_list_screen.dart b/lib/ui/work_list/work_list_screen.dart index 7637cd1..954558d 100644 --- a/lib/ui/work_list/work_list_screen.dart +++ b/lib/ui/work_list/work_list_screen.dart @@ -125,6 +125,17 @@ class _WorkListScreenState extends State { key: 'PAY_REQ', disable: false, ), + // WorkListItemTypeModelData( + // value: 0, + // name: 'FA Disposal Request ', + // fullName: LocaleKeys.faRequest.tr(), + // active: false, + // color: [Color(0xff42d7bf), Color(0xff42d7bf)], + // icon: "assets/images/miss_swipe.svg", + // key: 'HMG_FA_D', + // disable: false, + // ), + ]; int? workListItemIndex; diff --git a/lib/widgets/bottom_sheet.dart b/lib/widgets/bottom_sheet.dart index 4101746..7db0935 100644 --- a/lib/widgets/bottom_sheet.dart +++ b/lib/widgets/bottom_sheet.dart @@ -1,5 +1,8 @@ +import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; +import 'package:mohem_flutter_app/classes/colors.dart'; import 'package:mohem_flutter_app/extensions/int_extensions.dart'; +import 'package:mohem_flutter_app/generated/locale_keys.g.dart'; void showMyBottomSheet(BuildContext context, {required Widget child, required VoidCallback callBackFunc, String? type}) { showModalBottomSheet( @@ -49,6 +52,82 @@ void showMyBottomSheet(BuildContext context, {required Widget child, required Vo }); } + + Widget openWorkListBottomSheet(BuildContext context, String? val, String? title){ + return SafeArea( + child: Container( + padding: const EdgeInsets.all(16), + height: MediaQuery.of(context).size.height * 0.3 , // half-screen height + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + // ---- Top Row with Title & Close Button ---- + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text( + title ?? "Details", + style: const TextStyle( + color: Color(0xff2BB8A6), + fontSize: 14, + fontWeight: FontWeight.bold, + ), + ), + IconButton( + icon: const Icon(Icons.close, color: Colors.black54, size: 20), + onPressed: () { + Navigator.pop(context); + }, + ), + ], + ), + const Divider(height: 1, color: Colors.grey), + const SizedBox(height: 12), + + // ---- Scrollable Content ---- + Expanded( + child: SingleChildScrollView( + child: Text( + (val?.isEmpty ?? true) + ? "--" + : val.toString(), + style: TextStyle( + color: MyColors.normalTextColor, + fontSize: 14, + height: 1.4, + ), + ), + ), + ), + SizedBox( + width: double.infinity, + child: ElevatedButton( + style: ElevatedButton.styleFrom( + backgroundColor: const Color(0xff2BB8A6), + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(8), + ), + padding: const EdgeInsets.symmetric(vertical: 12), + ), + onPressed: () { + Navigator.pop(context); + }, + child: Text( + LocaleKeys.close.tr(), + style: const TextStyle( + color: Colors.white, + fontSize: 14, + fontWeight: FontWeight.bold, + ), + ), + ), + ), + ], + ), + ), + ); +} + class BottomSheetItem extends StatelessWidget { final Function onTap; final IconData icon; diff --git a/lib/widgets/item_detail_view_widget.dart b/lib/widgets/item_detail_view_widget.dart index 64bbd01..de82afe 100644 --- a/lib/widgets/item_detail_view_widget.dart +++ b/lib/widgets/item_detail_view_widget.dart @@ -1,11 +1,14 @@ import 'dart:convert'; +import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.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/extensions/widget_extensions.dart'; +import 'package:mohem_flutter_app/generated/locale_keys.g.dart'; import 'package:mohem_flutter_app/models/itg_forms_models/itg_worklist_table_model.dart'; +import 'package:mohem_flutter_app/widgets/bottom_sheet.dart'; class ItemDetailView extends StatelessWidget { final String title; @@ -40,7 +43,7 @@ class ItemDetailViewCol extends StatelessWidget { children: [ "$title:".toText12(isBold: true, color: const Color(0xff2BB8A6), maxLine: 2), 4.width, - (value.isEmpty ? "--" : value).toText12(color: MyColors.normalTextColor, maxLine: 5), + Flexible(child: (value.isEmpty ? "--" : value).toText12(color: MyColors.normalTextColor, maxLine: null)), ], ); } @@ -84,18 +87,51 @@ class ItemDetailViewGridItem extends StatelessWidget { mainAxisAlignment: MainAxisAlignment.center, mainAxisSize: MainAxisSize.min, children: [ - title != null ? Flexible(child: "$title:".toText12Auto(isBold: true, color: const Color(0xff2BB8A6))) : Container(), + title != null ? Flexible(child: "$title:".toText12(isBold: true, color: const Color(0xff2BB8A6))) : Container(), 4.width, - type != null - ? type!.toLowerCase() == "table" - ? getStringFromJSON(value!) - // : Flexible(child: (value!.isEmpty ? "--" : value).toString().toText12Auto(color: MyColors.normalTextColor, maxLine: 5)) - : (value!.isEmpty ? "--" : value).toString().toText12Auto(color: MyColors.normalTextColor, maxLine: maxLine) - : Container(), + type != null + ? type!.toLowerCase() == "table" + ? getStringFromJSON(value!) + // : Flexible(child: (value!.isEmpty ? "--" : value).toString().toText12Auto(color: MyColors.normalTextColor, maxLine: 5)) + : (value!.isEmpty ? "--" : value).toString().toText12(color: MyColors.normalTextColor, maxLine: 2) + : Container(), + if (value!.length > 100) + GestureDetector( + onTap: () { + showModalBottomSheet( + context: context, + enableDrag: true, + isDismissible: true, + shape: const RoundedRectangleBorder( + borderRadius: BorderRadius.only(topLeft: Radius.circular(12), topRight: Radius.circular(12)), + ), + backgroundColor: Colors.white, + builder: (context) { + return openWorkListBottomSheet(context, value, title); + }, + ); + + }, + child: Padding( + padding: const EdgeInsets.only(top: 4), + child: Text( + LocaleKeys.showMore.tr(), + textAlign: TextAlign.right, + style: const TextStyle( + color: Color(0xff2BB8A6), + fontSize: 12, + fontWeight: FontWeight.w600, + + ), + ), + ), + ), ], - ).paddingOnly(top: showSpaceAfterLine ? 16 : 0), + + ).paddingOnly(top: showSpaceAfterLine ? 16 : 0, left: 2, right: 2), ); } + } class ItemDetailGrid extends StatelessWidget { @@ -153,3 +189,4 @@ Widget getStringFromJSON(String jsonString) { return Flexible(child: ("-").toString().toText12Auto(color: MyColors.normalTextColor)); } } +