work-list fixes

worklist-change
Sultan khan 4 weeks ago
parent b96c460d6b
commit c9d5ab98a3

@ -846,4 +846,19 @@ class WorkListApiClient {
postParams, postParams,
); );
} }
Future<List<GetAbsenceCollectionNotificationBodyList>?> getFADisposalNtfDetails(int? notificationId) async {
String url = "${ApiConsts.erpRest}GET_PAY_REQ_NOTIFICATION_BODY";
Map<String, dynamic> 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,
);
}
} }

@ -11,11 +11,11 @@ class ApiConsts {
// static String baseUrl = "https://mohemm.hmg.com"; // New Live server // 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 = "http://10.20.200.111:1010/";
// static String baseUrl = "https://webservices.hmg.com"; // PreProd // 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 baseUrl = "https://hmgwebservices.com"; // Live server
static String baseUrlServices = baseUrl + "/Services/"; // server static String baseUrlServices = baseUrl + "/Services/"; // server

@ -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, this,
textAlign: isCenter ? TextAlign.center : null, textAlign: isCenter ? TextAlign.center : null,
maxLines: (maxLine > 0) ? maxLine : null, maxLines: maxLine == 0 ? null : maxLine,
style: TextStyle( style: TextStyle(
fontSize: 12, fontSize: 12,
fontWeight: isBold ? FontWeight.bold : FontWeight.w600, fontWeight: isBold ? FontWeight.bold : FontWeight.w600,
color: color ?? MyColors.darkTextColor, color: color ?? MyColors.darkTextColor,
letterSpacing: -0.72, letterSpacing: -0.72,
decoration: isUnderLine ? TextDecoration.underline : null, 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, this,
textAlign: isCenter ? TextAlign.center : null, textAlign: isCenter ? TextAlign.center : null,
maxLines: (maxLine > 0) ? maxLine : null, maxLines: maxLine == 0 ? null : maxLine,
minFontSize: 8, minFontSize: 8,
style: TextStyle( style: TextStyle(
fontSize: 12, fontSize: 12,
fontWeight: isBold ? FontWeight.bold : FontWeight.w600, fontWeight: isBold ? FontWeight.bold : FontWeight.w600,
color: color ?? MyColors.darkTextColor, color: color ?? MyColors.darkTextColor,
overflow: overflow,
letterSpacing: -0.72, letterSpacing: -0.72,
decoration: isUnderLine ? TextDecoration.underline : null, decoration: isUnderLine ? TextDecoration.underline : null,
), ),

@ -633,7 +633,9 @@ class CodegenLoader extends AssetLoader{
"mazaya": "مازيا", "mazaya": "مازيا",
"benefits": "فوائد", "benefits": "فوائد",
"mazayaDesc": "اكتشف الخصومات والعروض الخاصة المتاحة للموظفين", "mazayaDesc": "اكتشف الخصومات والعروض الخاصة المتاحة للموظفين",
"viewallofferMazaya": "أعرض كل المزايا" "viewallofferMazaya": "أعرض كل المزايا",
"faDisposalRequest":"طلب التخلص من FA",
"showMore": "إظهار المزيد"
}; };
static const Map<String,dynamic> _en_US = { static const Map<String,dynamic> _en_US = {
"mohemm": "Mohemm", "mohemm": "Mohemm",
@ -1254,7 +1256,9 @@ static const Map<String,dynamic> _en_US = {
"mazaya": "MAZAYA", "mazaya": "MAZAYA",
"benefits": "Benefits", "benefits": "Benefits",
"mazayaDesc": "Discover special Discounts and offers available to Employees", "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<String, Map<String,dynamic>> mapLocales = {"ar_SA": _ar_SA, "en_US": _en_US}; static const Map<String, Map<String,dynamic>> mapLocales = {"ar_SA": _ar_SA, "en_US": _en_US};
} }

@ -606,5 +606,6 @@ abstract class LocaleKeys {
static const benefits = 'benefits'; static const benefits = 'benefits';
static const mazayaDesc = 'mazayaDesc'; static const mazayaDesc = 'mazayaDesc';
static const viewallofferMazaya = 'viewallofferMazaya'; static const viewallofferMazaya = 'viewallofferMazaya';
static const faRequest = 'faDisposalRequest';
static const showMore = 'showMore';
} }

@ -125,6 +125,17 @@ class _WorkListScreenState extends State<WorkListScreen> {
key: 'PAY_REQ', key: 'PAY_REQ',
disable: false, 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; int? workListItemIndex;

@ -1,5 +1,8 @@
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.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/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}) { void showMyBottomSheet(BuildContext context, {required Widget child, required VoidCallback callBackFunc, String? type}) {
showModalBottomSheet<String>( showModalBottomSheet<String>(
@ -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 { class BottomSheetItem extends StatelessWidget {
final Function onTap; final Function onTap;
final IconData icon; final IconData icon;

@ -1,11 +1,14 @@
import 'dart:convert'; import 'dart:convert';
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:mohem_flutter_app/classes/colors.dart'; import 'package:mohem_flutter_app/classes/colors.dart';
import 'package:mohem_flutter_app/extensions/int_extensions.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/string_extensions.dart';
import 'package:mohem_flutter_app/extensions/widget_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/models/itg_forms_models/itg_worklist_table_model.dart';
import 'package:mohem_flutter_app/widgets/bottom_sheet.dart';
class ItemDetailView extends StatelessWidget { class ItemDetailView extends StatelessWidget {
final String title; final String title;
@ -40,7 +43,7 @@ class ItemDetailViewCol extends StatelessWidget {
children: [ children: [
"$title:".toText12(isBold: true, color: const Color(0xff2BB8A6), maxLine: 2), "$title:".toText12(isBold: true, color: const Color(0xff2BB8A6), maxLine: 2),
4.width, 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, mainAxisAlignment: MainAxisAlignment.center,
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: [ 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, 4.width,
type != null type != null
? type!.toLowerCase() == "table" ? type!.toLowerCase() == "table"
? getStringFromJSON(value!) ? getStringFromJSON(value!)
// : Flexible(child: (value!.isEmpty ? "--" : value).toString().toText12Auto(color: MyColors.normalTextColor, maxLine: 5)) // : Flexible(child: (value!.isEmpty ? "--" : value).toString().toText12Auto(color: MyColors.normalTextColor, maxLine: 5))
: (value!.isEmpty ? "--" : value).toString().toText12Auto(color: MyColors.normalTextColor, maxLine: maxLine) : (value!.isEmpty ? "--" : value).toString().toText12(color: MyColors.normalTextColor, maxLine: 2)
: Container(), : 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 { class ItemDetailGrid extends StatelessWidget {
@ -153,3 +189,4 @@ Widget getStringFromJSON(String jsonString) {
return Flexible(child: ("-").toString().toText12Auto(color: MyColors.normalTextColor)); return Flexible(child: ("-").toString().toText12Auto(color: MyColors.normalTextColor));
} }
} }

Loading…
Cancel
Save