Merge branch 'master' into development_aamir

merge-requests/188/head
Aamir Muhammad 3 years ago
commit 617145fd07

File diff suppressed because one or more lines are too long

@ -5,7 +5,6 @@ import 'package:mohem_flutter_app/api/api_client.dart';
import 'package:mohem_flutter_app/app_state/app_state.dart';
import 'package:mohem_flutter_app/classes/consts.dart';
import 'package:mohem_flutter_app/classes/date_uitl.dart';
import 'package:mohem_flutter_app/classes/utils.dart';
import 'package:mohem_flutter_app/models/dashboard/get_accrual_balances_list_model.dart';
import 'package:mohem_flutter_app/models/dashboard/get_attendance_tracking_list_model.dart';
import 'package:mohem_flutter_app/models/dashboard/itg_forms_model.dart';
@ -13,7 +12,6 @@ import 'package:mohem_flutter_app/models/dashboard/list_menu.dart';
import 'package:mohem_flutter_app/models/generic_response_model.dart';
import 'package:mohem_flutter_app/models/itg/itg_main_response.dart';
import 'package:mohem_flutter_app/models/itg/itg_response_model.dart';
import 'package:platform_device_id/platform_device_id.dart';
import 'package:uuid/uuid.dart';
class DashboardApiClient {
@ -109,11 +107,12 @@ class DashboardApiClient {
//Mark Attendance
Future<GenericResponseModel?> markAttendance({String lat = "0", String? long = "0", required int pointType, String nfcValue = "", bool isGpsRequired = false, String QRValue = ""}) async {
String url = "${ApiConsts.swpRest}AuthenticateAndSwipeUserSupportNFC";
// var uuid = Uuid();
var uuid = Uuid();
// Generate a v4 (random) id
Map<String, dynamic> postParams = {
"UID": await PlatformDeviceId.getDeviceId, //uuid.v4(), //Mobile Id
// "UID": await PlatformDeviceId.getDeviceId, //uuid.v4(), //Mobile Id
"UID": uuid.v4(), //Mobile Id
"Latitude": lat,
"Longitude": long,
"QRValue": QRValue,
@ -201,18 +200,18 @@ class DashboardApiClient {
}, url, postParams);
}
Future setAdvertisementViewed(String masterID, int advertisementId) async {
String url = "${ApiConsts.cocRest}Mohemm_ITG_UpdateAdvertisementAsViewed";
Map<String, dynamic> postParams = {
"ItgNotificationMasterId": masterID,
"EmployeeNumber": AppState().memberInformationList!.eMPLOYEENUMBER.toString(),
"ItgAdvertisement": {"advertisementId": advertisementId, "acknowledgment": true} //Mobile Id
};
postParams.addAll(AppState().postParamsJson);
return await ApiClient().postJsonForObject((json) {
// ItgMainRes responseData = ItgMainRes.fromJson(json);
return json;
}, url, postParams);
}
Future setAdvertisementViewed(String masterID, int advertisementId) async {
String url = "${ApiConsts.cocRest}Mohemm_ITG_UpdateAdvertisementAsViewed";
Map<String, dynamic> postParams = {
"ItgNotificationMasterId": masterID,
"EmployeeNumber": AppState().memberInformationList!.eMPLOYEENUMBER.toString(),
"ItgAdvertisement": {"advertisementId": advertisementId, "acknowledgment": true} //Mobile Id
};
postParams.addAll(AppState().postParamsJson);
return await ApiClient().postJsonForObject((json) {
// ItgMainRes responseData = ItgMainRes.fromJson(json);
return json;
}, url, postParams);
}
}

@ -14,6 +14,7 @@ import 'package:mohem_flutter_app/models/get_mo_notification_body_list_model.dar
import 'package:mohem_flutter_app/models/get_notification_buttons_list_model.dart';
import 'package:mohem_flutter_app/models/get_po_Item_history_list_model.dart';
import 'package:mohem_flutter_app/models/get_po_notification_body_list_model.dart';
import 'package:mohem_flutter_app/models/get_pr_information_list.dart';
import 'package:mohem_flutter_app/models/get_pr_notification_body_list_model.dart';
import 'package:mohem_flutter_app/models/get_quotation_analysis_list_model.dart';
import 'package:mohem_flutter_app/models/get_stamp_ms_notification_body_list_model.dart';
@ -626,4 +627,19 @@ class WorkListApiClient {
return responseData.updateUserItemTypesList;
}, url, postParams);
}
Future<GetPRInformationList?> getPRDetailsForPO(String poLineID) async {
String url = "${ApiConsts.erpRest}GET_PR_INFORMATION";
Map<String, dynamic> postParams = {
"P_PO_LINE_ID": poLineID,
"P_PAGE_LIMIT": 100,
"P_PAGE_NUM": 1,
};
postParams.addAll(AppState().postParamsJson);
return await ApiClient().postJsonForObject((json) {
GenericResponseModel responseData = GenericResponseModel.fromJson(json);
return responseData.getPRInformationList;
}, url, postParams);
}
}

@ -9,4 +9,5 @@ class MyLottieConsts {
static const String congratsGif = "assets/images/congrats.gif";
static const String loadingLottie = "assets/lottie/loading_lottie.json";
static const String noWinnerLottie = "assets/lottie/no_winner.json";
static const String audioPlaybackLottie = "assets/lottie/audio_playback.json";
}

@ -0,0 +1,21 @@
import 'package:flutter/foundation.dart';
import 'package:just_audio/just_audio.dart';
class MyCustomStream extends StreamAudioSource {
final Uint8List bytes;
MyCustomStream(this.bytes);
@override
Future<StreamAudioResponse> request([int? start, int? end]) async {
start ??= 0;
end ??= bytes.length;
return StreamAudioResponse(
sourceLength: bytes.length,
contentLength: end - start,
offset: start,
stream: Stream.value(bytes.sublist(start, end)),
contentType: 'audio/aac',
);
}
}

@ -72,7 +72,7 @@ class AppNotifications {
if (Platform.isAndroid) {
// await hmsApiAvailability.isHMSAvailable().then((value) async {
if (await Utils.isAppInstalledFromHuawei()) {
if (!(await Utils.isGoogleServicesAvailable())) {
huawei_push.Push.enableLogger();
var result = await huawei_push.Push.setAutoInitEnabled(true);

@ -394,20 +394,6 @@ class Utils {
}
//HUAWEI DECISION MAKING
static Future<bool> isAppInstalledFromHuawei() async {
Source installationSource = await StoreChecker.getSource;
if (installationSource == Source.IS_INSTALLED_FROM_HUAWEI_APP_GALLERY) {
return true;
}
return false;
}
static Future<String> getInstallationSource() async {
Source installationSource = await StoreChecker.getSource;
return installationSource.toString().split(".")[1];
}
static Future<bool> isGoogleServicesAvailable() async {
GooglePlayServicesAvailability availability = await GoogleApiAvailability.instance.checkGooglePlayServicesAvailability();
String status = availability.toString().split('.').last;

@ -28,6 +28,7 @@ import 'package:mohem_flutter_app/models/get_mobile_login_info_list_model.dart';
import 'package:mohem_flutter_app/models/get_notification_buttons_list_model.dart';
import 'package:mohem_flutter_app/models/get_po_Item_history_list_model.dart';
import 'package:mohem_flutter_app/models/get_po_notification_body_list_model.dart';
import 'package:mohem_flutter_app/models/get_pr_information_list.dart';
import 'package:mohem_flutter_app/models/get_pr_notification_body_list_model.dart';
import 'package:mohem_flutter_app/models/get_quotation_analysis_list_model.dart';
import 'package:mohem_flutter_app/models/get_schedule_shifts_details_list_model.dart';
@ -226,6 +227,7 @@ class GenericResponseModel {
List<GetPoItemHistoryList>? getPoItemHistoryList;
GetPoNotificationBodyList? getPoNotificationBodyList;
GetPrNotificationBodyList? getPrNotificationBodyList;
GetPRInformationList? getPRInformationList;
List<GetQuotationAnalysisList>? getQuotationAnalysisList;
List<GetRFCEmployeeList>? getRFCEmployeeListList;
List<String>? getRespondAttributeValueList;
@ -490,6 +492,7 @@ class GenericResponseModel {
this.getPoItemHistoryList,
this.getPoNotificationBodyList,
this.getPrNotificationBodyList,
this.getPRInformationList,
this.getQuotationAnalysisList,
this.getRFCEmployeeListList,
this.getRespondAttributeValueList,
@ -979,6 +982,7 @@ class GenericResponseModel {
}
getPoNotificationBodyList = json['GetPoNotificationBodyList'] != null ? GetPoNotificationBodyList.fromJson(json['GetPoNotificationBodyList']) : null;
getPrNotificationBodyList = json['GetPrNotificationBodyList'] != null ? GetPrNotificationBodyList.fromJson(json['GetPrNotificationBodyList']) : null;
getPRInformationList = json['PR_Information_List'] != null ? GetPRInformationList.fromJson(json['PR_Information_List']) : null;
if (json['GetQuotationAnalysisList'] != null) {
getQuotationAnalysisList = <GetQuotationAnalysisList>[];
json['GetQuotationAnalysisList'].forEach((v) {
@ -1602,6 +1606,10 @@ class GenericResponseModel {
data['GetPrNotificationBodyList'] = this.getPrNotificationBodyList!.toJson();
}
if (this.getPRInformationList != null) {
data['PR_Information_List'] = this.getPRInformationList!.toJson();
}
if (this.getQuotationAnalysisList != null) {
data['GetQuotationAnalysisList'] = this.getQuotationAnalysisList!.map((v) => v.toJson()).toList();
}

@ -158,6 +158,7 @@ class POLines {
String? nEEDBYDATE;
int? nOOFROWS;
int? pOHEADERID;
int? pOLINEID;
String? pROMISEDDATE;
String? pRNUM;
num? qUANTITY;
@ -181,6 +182,7 @@ class POLines {
this.nEEDBYDATE,
this.nOOFROWS,
this.pOHEADERID,
this.pOLINEID,
this.pROMISEDDATE,
this.pRNUM,
this.qUANTITY,
@ -204,6 +206,7 @@ class POLines {
nEEDBYDATE = json['NEED_BY_DATE'];
nOOFROWS = json['NO_OF_ROWS'];
pOHEADERID = json['PO_HEADER_ID'];
pOLINEID = json['PO_LINE_ID'];
pROMISEDDATE = json['PROMISED_DATE'];
pRNUM = json['PR_NUM'];
qUANTITY = json['QUANTITY'];
@ -229,6 +232,7 @@ class POLines {
data['NEED_BY_DATE'] = this.nEEDBYDATE;
data['NO_OF_ROWS'] = this.nOOFROWS;
data['PO_HEADER_ID'] = this.pOHEADERID;
data['PO_LINE_ID'] = this.pOLINEID;
data['PROMISED_DATE'] = this.pROMISEDDATE;
data['PR_NUM'] = this.pRNUM;
data['QUANTITY'] = this.qUANTITY;

@ -0,0 +1,125 @@
class GetPRInformationList {
List<PRHeader>? pRHeader;
List<PRLines>? pRLines;
String? pCURRENCYCODE;
GetPRInformationList({this.pRHeader, this.pRLines, this.pCURRENCYCODE});
GetPRInformationList.fromJson(Map<String, dynamic> json) {
if (json['PRHeader'] != null) {
pRHeader = <PRHeader>[];
json['PRHeader'].forEach((v) {
pRHeader!.add(new PRHeader.fromJson(v));
});
}
if (json['PRLines'] != null) {
pRLines = <PRLines>[];
json['PRLines'].forEach((v) {
pRLines!.add(new PRLines.fromJson(v));
});
}
pCURRENCYCODE = json['P_CURRENCY_CODE'];
}
Map<String, dynamic> toJson() {
Map<String, dynamic> data = new Map<String, dynamic>();
if (this.pRHeader != null) {
data['PRHeader'] = this.pRHeader!.map((v) => v.toJson()).toList();
}
if (this.pRLines != null) {
data['PRLines'] = this.pRLines!.map((v) => v.toJson()).toList();
}
data['P_CURRENCY_CODE'] = this.pCURRENCYCODE;
return data;
}
}
class PRHeader {
String? dESCRIPTION;
String? pRNUMBER;
String? rEQUISITIONTOTAL;
String? tAXTOTAL;
PRHeader({this.dESCRIPTION, this.pRNUMBER, this.rEQUISITIONTOTAL, this.tAXTOTAL});
PRHeader.fromJson(Map<String, dynamic> json) {
dESCRIPTION = json['DESCRIPTION'];
pRNUMBER = json['PR_NUMBER'];
rEQUISITIONTOTAL = json['REQUISITION_TOTAL'];
tAXTOTAL = json['TAX_TOTAL'];
}
Map<String, dynamic> toJson() {
Map<String, dynamic> data = new Map<String, dynamic>();
data['DESCRIPTION'] = this.dESCRIPTION;
data['PR_NUMBER'] = this.pRNUMBER;
data['REQUISITION_TOTAL'] = this.rEQUISITIONTOTAL;
data['TAX_TOTAL'] = this.tAXTOTAL;
return data;
}
}
class PRLines {
String? cOSTCENTER;
String? dESCRIPTION;
int? fROMROWNUM;
int? iTEMAMU;
String? iTEMCODE;
int? lINEAMOUNT;
int? lINENUM;
int? nOOFROWS;
int? qUANTITY;
int? rOWNUM;
int? tOROWNUM;
int? uNITPRICE;
String? uOM;
PRLines(
{this.cOSTCENTER,
this.dESCRIPTION,
this.fROMROWNUM,
this.iTEMAMU,
this.iTEMCODE,
this.lINEAMOUNT,
this.lINENUM,
this.nOOFROWS,
this.qUANTITY,
this.rOWNUM,
this.tOROWNUM,
this.uNITPRICE,
this.uOM});
PRLines.fromJson(Map<String, dynamic> json) {
cOSTCENTER = json['COST_CENTER'];
dESCRIPTION = json['DESCRIPTION'];
fROMROWNUM = json['FROM_ROW_NUM'];
iTEMAMU = json['ITEM_AMU'];
iTEMCODE = json['ITEM_CODE'];
lINEAMOUNT = json['LINE_AMOUNT'];
lINENUM = json['LINE_NUM'];
nOOFROWS = json['NO_OF_ROWS'];
qUANTITY = json['QUANTITY'];
rOWNUM = json['ROW_NUM'];
tOROWNUM = json['TO_ROW_NUM'];
uNITPRICE = json['UNIT_PRICE'];
uOM = json['UOM'];
}
Map<String, dynamic> toJson() {
Map<String, dynamic> data = new Map<String, dynamic>();
data['COST_CENTER'] = this.cOSTCENTER;
data['DESCRIPTION'] = this.dESCRIPTION;
data['FROM_ROW_NUM'] = this.fROMROWNUM;
data['ITEM_AMU'] = this.iTEMAMU;
data['ITEM_CODE'] = this.iTEMCODE;
data['LINE_AMOUNT'] = this.lINEAMOUNT;
data['LINE_NUM'] = this.lINENUM;
data['NO_OF_ROWS'] = this.nOOFROWS;
data['QUANTITY'] = this.qUANTITY;
data['ROW_NUM'] = this.rOWNUM;
data['TO_ROW_NUM'] = this.tOROWNUM;
data['UNIT_PRICE'] = this.uNITPRICE;
data['UOM'] = this.uOM;
return data;
}
}

@ -8,6 +8,7 @@ import 'package:just_audio/just_audio.dart';
import 'package:mohem_flutter_app/api/chat/chat_api_client.dart';
import 'package:mohem_flutter_app/app_state/app_state.dart';
import 'package:mohem_flutter_app/classes/colors.dart';
import 'package:mohem_flutter_app/classes/my_custom_stream.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';
@ -429,7 +430,7 @@ class ChatBubble extends StatelessWidget {
Widget getPlayer({required AudioPlayer player, required SingleUserChatModel modelData}) {
return StreamBuilder<PlayerState>(
stream: player!.playerStateStream,
stream: player.playerStateStream,
builder: (BuildContext context, AsyncSnapshot<PlayerState> snapshot) {
PlayerState? playerState = snapshot.data;
ProcessingState? processingState = playerState?.processingState;
@ -442,7 +443,7 @@ class ChatBubble extends StatelessWidget {
child: const CircularProgressIndicator(),
);
} else if (playing != true) {
return Icon(
return const Icon(
Icons.play_arrow,
size: 30,
color: MyColors.lightGreenColor,
@ -470,22 +471,3 @@ class ChatBubble extends StatelessWidget {
);
}
}
class MyCustomStream extends StreamAudioSource {
final Uint8List bytes;
MyCustomStream(this.bytes);
@override
Future<StreamAudioResponse> request([int? start, int? end]) async {
start ??= 0;
end ??= bytes.length;
return StreamAudioResponse(
sourceLength: bytes.length,
contentLength: end - start,
offset: start,
stream: Stream.value(bytes.sublist(start, end)),
contentType: 'audio/aac',
);
}
}

@ -296,25 +296,7 @@ class _DashboardScreenState extends State<DashboardScreen> with WidgetsBindingOb
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
LocaleKeys.welcomeBack.tr().toText14(color: MyColors.grey77Color),
(AppState().memberInformationList!.eMPLOYEENAME ?? "").toText24(isBold: true).onPress(() async {
return showMDialog(
context,
backgroundColor: Colors.transparent,
isDismissable: true,
child: SizedBox(
width: MediaQuery.of(context).size.width / 2.2,
height: MediaQuery.of(context).size.width / 2.2,
child: Card(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(25.0),
),
child: Center(
child: "This app is installed from ${await Utils.getInstallationSource()}".toText16(isCentered: true),
),
),
),
);
}),
(AppState().memberInformationList!.eMPLOYEENAME ?? "").toText24(isBold: true),
16.height,
Row(
children: [

@ -5,8 +5,10 @@ import 'dart:typed_data';
import 'package:flutter/material.dart';
import 'package:flutter_countdown_timer/index.dart';
import 'package:lottie/lottie.dart';
import 'package:mohem_flutter_app/api/dashboard_api_client.dart';
import 'package:mohem_flutter_app/classes/colors.dart';
import 'package:mohem_flutter_app/classes/lottie_consts.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';
@ -29,6 +31,7 @@ class _ITGAdsScreenState extends State<ITGAdsScreen> {
bool skip = false;
bool isVideo = false;
bool isImage = false;
bool isAudio = false;
String ext = '';
late File imageFile;
ads.Advertisement? advertisementData;
@ -44,11 +47,13 @@ class _ITGAdsScreenState extends State<ITGAdsScreen> {
await processImage(rFile!);
isImage = true;
} else {
if (ext == ".aac") {
isAudio = true;
}
isVideo = true;
_futureController = createVideoPlayer(rFile!);
}
setState(() {});
// initTimer();
}
Future processImage(String encodedBytes) async {
@ -89,18 +94,19 @@ class _ITGAdsScreenState extends State<ITGAdsScreen> {
@override
void dispose() {
_controller.dispose();
// player.stop();
// player.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
data = ModalRoute.of(context)!.settings.arguments;
if (advertisementData == null) advertisementData = data["advertisement"] as ads.Advertisement;
if (masterID == null) masterID = data["masterId"];
advertisementData ??= data["advertisement"] as ads.Advertisement;
masterID ??= data["masterId"];
if (advertisementData != null) {
checkFileType();
videoDuration = advertisementData?.durationInSeconds ?? 0;
print("VIDEO DURATION: $videoDuration");
}
return Scaffold(
backgroundColor: Colors.black,
@ -116,10 +122,12 @@ class _ITGAdsScreenState extends State<ITGAdsScreen> {
mainAxisAlignment: MainAxisAlignment.center,
children: [
Center(
child: AspectRatio(
aspectRatio: _controller.value.aspectRatio,
child: VideoPlayer(_controller),
),
child: isAudio
? Lottie.asset(MyLottieConsts.audioPlaybackLottie)
: AspectRatio(
aspectRatio: _controller.value.aspectRatio,
child: VideoPlayer(_controller),
),
),
30.height,
CountdownTimer(
@ -165,7 +173,6 @@ class _ITGAdsScreenState extends State<ITGAdsScreen> {
},
),
if (isImage) Image.file(imageFile),
// if (skip)
],
),
);

@ -103,8 +103,6 @@ class _LoginScreenState extends State<LoginScreen> {
Utils.showLoading(context);
if (Platform.isAndroid) {
try {
// await hmsApiAvailability.isHMSAvailable().then((value) async {
// if (await Utils.isAppInstalledFromHuawei() && !(await Utils.isGoogleServicesAvailable())) {
if (!(await Utils.isGoogleServicesAvailable())) {
//print("HUAWEI APPPP GALLERYYYY!!!!");
AppState().setIsHuawei = true;

@ -219,7 +219,7 @@ class MarathonProvider extends ChangeNotifier {
oneSec,
(Timer timer) async {
// This 1 is just to show the color of answer tile for 1 and then update card status
if (totalCurrentQuestionTime - currentGapTime == 1) {
if (totalCurrentQuestionTime - currentGapTime == 0) {
if (callCountThreshold == 0) {
getCorrectAnswerAndUpdateAnswerColor();
}

@ -130,7 +130,7 @@ class AnswerContent extends StatelessWidget {
return AnswerTileForText(
index: index,
onAnswerTapped: () {
if (provider.totalCurrentQuestionTime - provider.currentGapTime <= 1) {
if (provider.totalCurrentQuestionTime - provider.currentGapTime <= 0) {
null;
} else {
provider.updateCurrentQuestionOptionStatus(QuestionsOptionStatus.selected, index);

@ -1,3 +1,4 @@
import 'dart:convert';
import 'dart:io';
import 'package:easy_localization/easy_localization.dart';
@ -71,27 +72,31 @@ class _RequestSubmitScreenState extends State<RequestSubmitScreen> {
}
}
Future<List<Map<String, dynamic>>> addAttachments() async {
List<Map<String, dynamic>> list = [];
if (attachmentFiles.isNotEmpty) {
attachmentFiles.asMap().forEach((index, value) {
String type = attachmentFiles[index].path.split('.').last;
String name = attachmentFiles[index].path.split('/').last;
List<int> fileContent = value.readAsBytesSync();
String encodedFile = base64Encode(fileContent);
list.add(AttachmentModel(
attachmentID: index,
pFILECONTENTTYPE: type,
pFILENAME: name,
pFILEDATA: encodedFile,
pTRANSACTIONID: params!.transactionId,
).toJson());
});
}
return list;
}
void submitRequest() async {
try {
Utils.showLoading(context);
List<Map<String, dynamic>> list = [];
if (attachmentFiles.isNotEmpty) {
attachments.asMap().forEach((index, value) async {
String type = attachmentFiles[index].path.split('.').last;
String name = attachmentFiles[index].path.split('/').last;
// List<int> fileContent = await value.readAsBytes();
// String encodedFile = base64Encode(fileContent);
list.add(AttachmentModel(
attachmentID: index,
pFILECONTENTTYPE: type,
pFILENAME: name,
pFILEDATA: value,
pTRANSACTIONID: params!.transactionId,
).toJson());
});
}
List<Map<String, dynamic>> list = await addAttachments();
await MyAttendanceApiClient().addAttachment(list);
if (params!.approvalFlag == 'phone_numbers') {
await ProfileApiClient().startPhoneApprovalProcess(
"SUBMIT",

@ -1,5 +1,3 @@
import 'dart:convert';
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
@ -98,9 +96,7 @@ class _ItemsForSaleFragmentState extends State<ItemsForSaleFragment> {
currentCategoryID == getSaleCategoriesList[index].categoryID ? const Icon(Icons.check_circle_rounded, color: MyColors.greenColor, size: 16.0) : Container(),
],
).expanded,
AppState().isArabic(context)
?getSaleCategoriesList[index].titleAr!.toText10()
:getSaleCategoriesList[index].title!.toText10()
AppState().isArabic(context) ? getSaleCategoriesList[index].titleAr!.toText10() : getSaleCategoriesList[index].title!.toText10()
],
).paddingOnly(left: 10, right: 10, bottom: 10, top: 12).expanded.objectContainerView(disablePadding: true),
),
@ -163,8 +159,8 @@ class _ItemsForSaleFragmentState extends State<ItemsForSaleFragment> {
aspectRatio: 148 / 127,
child: ClipRRect(
borderRadius: BorderRadius.circular(6),
child: Image.memory(
base64Decode(getItemsForSaleList.itemAttachments![0].content!),
child: Image.network(
getItemsForSaleList.itemAttachments![0].filePath!,
fit: BoxFit.cover,
),
),

@ -139,8 +139,8 @@ class _ItemForSaleDetailPageState extends State<ItemForSaleDetailPage> {
padding: const EdgeInsets.only(left: 8.0, right: 8.0),
child: ClipRRect(
borderRadius: BorderRadius.circular(6),
child: Image.memory(
base64Decode(element.content!),
child: Image.network(
getItemsForSaleList.itemAttachments![0].filePath!,
fit: BoxFit.cover,
),
),

@ -7,6 +7,7 @@ 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_mo_Item_history_list_model.dart';
import 'package:mohem_flutter_app/models/get_po_Item_history_list_model.dart';
import 'package:mohem_flutter_app/models/get_pr_information_list.dart';
import 'package:mohem_flutter_app/models/get_quotation_analysis_list_model.dart';
import 'package:mohem_flutter_app/widgets/app_bar_widget.dart';
import 'package:mohem_flutter_app/widgets/item_detail_view_widget.dart';
@ -18,8 +19,10 @@ class ItemHistoryScreenParams {
int? pItemId;
int? pPoHeaderId;
int? pOrgId;
bool isPRInfo;
GetPRInformationList? getPRInformationList;
ItemHistoryScreenParams({@required this.title, this.isItemHistory = true, this.isMO = true, this.pItemId, this.pPoHeaderId, this.pOrgId});
ItemHistoryScreenParams({@required this.title, this.isItemHistory = true, this.isMO = true, this.isPRInfo = false, this.getPRInformationList, this.pItemId, this.pPoHeaderId, this.pOrgId});
}
class ItemHistoryScreen extends StatefulWidget {
@ -51,7 +54,9 @@ class _ItemHistoryScreenState extends State<ItemHistoryScreen> {
void loadData() {
if (_screenParams == null) {
_screenParams = ModalRoute.of(context)!.settings.arguments as ItemHistoryScreenParams;
getDataFromApi();
if (!_screenParams!.isPRInfo) {
getDataFromApi();
}
}
}
@ -86,15 +91,45 @@ class _ItemHistoryScreenState extends State<ItemHistoryScreen> {
padding: const EdgeInsets.all(21),
physics: const BouncingScrollPhysics(),
children: [
if (_screenParams!.isPRInfo) prLinesDataView(),
if (moItemHistoryList.isNotEmpty) loadMoItemHistoryData(),
if (poItemHistoryList.isNotEmpty) loadPoItemHistoryData(),
if (quotationAnalysisList.isNotEmpty) loadQuotationAnalysisData(),
if (moItemHistoryList.isEmpty && poItemHistoryList.isEmpty && quotationAnalysisList.isEmpty) Utils.getNoDataWidget(context),
if (moItemHistoryList.isEmpty && poItemHistoryList.isEmpty && quotationAnalysisList.isEmpty && !_screenParams!.isPRInfo) Utils.getNoDataWidget(context),
],
),
);
}
Widget prLinesDataView() {
return ListView.separated(
shrinkWrap: true,
physics: const NeverScrollableScrollPhysics(),
itemBuilder: (cxt, index) => Column(
children: [
ItemDetailGrid(
ItemDetailViewCol("Cost Center", _screenParams!.getPRInformationList!.pRLines![index].cOSTCENTER ?? ""),
ItemDetailViewCol("Code", _screenParams!.getPRInformationList!.pRLines![index].iTEMCODE ?? ""),
),
ItemDetailGrid(
ItemDetailViewCol("Unit", _screenParams!.getPRInformationList!.pRLines![index].uOM ?? ""),
ItemDetailViewCol("Price (SAR)", _screenParams!.getPRInformationList!.pRLines![index].uNITPRICE.toString() ?? ""),
),
ItemDetailGrid(
ItemDetailViewCol("Amount (SAR)", _screenParams!.getPRInformationList!.pRLines![index].lINEAMOUNT.toString() ?? ""),
ItemDetailViewCol("Quantity", _screenParams!.getPRInformationList!.pRLines![index].qUANTITY.toString() ?? ""),
),
ItemDetailGrid(
ItemDetailViewCol("AMU (Last 3 months)", _screenParams!.getPRInformationList!.pRLines![index].iTEMAMU.toString() ?? ""),
Container(),
isItLast: true,
),
],
).objectContainerView(),
separatorBuilder: (cxt, index) => 12.height,
itemCount: _screenParams!.getPRInformationList!.pRLines!.length);
}
Widget loadMoItemHistoryData() {
return ListView.separated(
shrinkWrap: true,

@ -1003,19 +1003,11 @@ class _WorkListDetailScreenState extends State<WorkListDetailScreen> {
try {
isActionHistoryLoaded = false;
actionHistoryList.clear();
// if (apiCallCount == 0) Utils.showLoading(context);
// apiCallCount++;
actionHistoryList = await WorkListApiClient().getActionHistory(workListData!.nOTIFICATIONID!);
// apiCallCount--;
// if (apiCallCount == 0) {
// Utils.hideLoading(context);
setState(() {
isActionHistoryLoaded = true;
});
// }
} catch (ex) {
// apiCallCount--;
// Utils.hideLoading(context);
Utils.handleException(ex, context, null);
}
}
@ -1024,88 +1016,15 @@ class _WorkListDetailScreenState extends State<WorkListDetailScreen> {
try {
isAttachmentLoaded = false;
getAttachmentList.clear();
// if (apiCallCount == 0) Utils.showLoading(context);
// apiCallCount++;
getAttachmentList = await WorkListApiClient().getAttachments(workListData!.nOTIFICATIONID!);
// apiCallCount--;
// if (apiCallCount == 0) {
// Utils.hideLoading(context);
setState(() {
isAttachmentLoaded = true;
});
// }
} catch (ex) {
// apiCallCount--;
// Utils.hideLoading(context);
Utils.handleException(ex, context, null);
}
}
// Widget showUpdateContinueSheet(List<GetEitCollectionNotificationBodyList> list) {
// double itemHeight = 0;
// double itemWidth = 0;
// var size = MediaQuery.of(context).size;
// itemHeight = (size.height - kToolbarHeight - 24) / 9;
// itemWidth = size.width / 2;
// return Column(
// children: [
// if ((workListData?.sUBJECT ?? "").isNotEmpty) workListData!.sUBJECT!.toText14().paddingOnly(top: 10, right: 21, left: 21, bottom: 21),
// ListView.separated(
// shrinkWrap: true,
// physics: const NeverScrollableScrollPhysics(),
// itemBuilder: (cxt, index) {
// List<CollectionNotificationEit> dataList = list.isEmpty ? [] : (list[index].collectionNotification ?? []);
// dataList = dataList.where((o) => o.displayFlag == "Y").toList();
// bool isOdd = false;
// if (dataList.length % 2 != 0) {
// isOdd = true;
// dataList.add(new CollectionNotificationEit());
// }
// return GridView.builder(
// itemCount: dataList.length,
// shrinkWrap: true,
// physics: const NeverScrollableScrollPhysics(),
// itemBuilder: (context, index) => ItemDetailViewGridItem(
// index,
// dataList[index].segmentPrompt,
// dataList[index].segmentValueDsp,
// isNeedToShowEmptyDivider: (dataList.length == index + 1)
// ? isOdd
// ? true
// : false
// : false,
// ),
// gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
// crossAxisCount: 2,
// childAspectRatio: (itemWidth / itemHeight),
// ),
// ).objectContainerView();
// },
// separatorBuilder: (cxt, index) => 12.height,
// itemCount: list.length,
// ),
// Padding(
// padding: const EdgeInsets.only(right: 21, left: 21, bottom: 21),
// child: Row(
// children: [
// DefaultButton(
// LocaleKeys.edit.tr(),
// () => performEditAction(),
// colors: const [Color(0xffE47A7E), Color(0xffDE6D71)],
// ).expanded,
// 8.width,
// DefaultButton(
// LocaleKeys.next.tr(),
// () => performNextAction(),
// colors: const [Color(0xff28C884), Color(0xff1BB271)],
// ).expanded,
// ],
// ),
// ),
// ],
// );
// }
Widget showLoadingAnimation() {
return Lottie.asset(
'assets/lottie/loading.json',

@ -1,7 +1,9 @@
import 'package:easy_localization/src/public_ext.dart';
import 'package:expandable/expandable.dart';
import 'package:flutter/material.dart';
import 'package:mohem_flutter_app/api/worklist/worklist_api_client.dart';
import 'package:mohem_flutter_app/classes/colors.dart';
import 'package:mohem_flutter_app/classes/utils.dart';
import 'package:mohem_flutter_app/config/routes.dart';
import 'package:mohem_flutter_app/extensions/int_extensions.dart';
import 'package:mohem_flutter_app/extensions/string_extensions.dart';
@ -10,7 +12,8 @@ import 'package:mohem_flutter_app/generated/locale_keys.g.dart';
import 'package:mohem_flutter_app/models/get_item_creation_ntf_body_list_model.dart';
import 'package:mohem_flutter_app/models/get_mo_notification_body_list_model.dart';
import 'package:mohem_flutter_app/models/get_po_notification_body_list_model.dart';
import 'package:mohem_flutter_app/models/get_pr_notification_body_list_model.dart';
import 'package:mohem_flutter_app/models/get_pr_information_list.dart';
import 'package:mohem_flutter_app/models/get_pr_notification_body_list_model.dart' as get_pr_notification_body_list_model;
import 'package:mohem_flutter_app/ui/work_list/item_history_screen.dart';
import 'package:mohem_flutter_app/widgets/button/default_button.dart';
import 'package:mohem_flutter_app/widgets/item_detail_view_widget.dart';
@ -19,14 +22,14 @@ class RequestFragment extends StatelessWidget {
final List<GetMoNotificationBodyList> moNotificationBodyList;
final List<ItemCreationLines> itemCreationLines;
final List<POLines> poLinesList;
final List<PRLines> prLinesList;
final List<get_pr_notification_body_list_model.PRLines> prLinesList;
RequestFragment({
Key? key,
this.moNotificationBodyList = const <GetMoNotificationBodyList>[],
this.itemCreationLines = const <ItemCreationLines>[],
this.poLinesList = const <POLines>[],
this.prLinesList = const <PRLines>[],
this.prLinesList = const <get_pr_notification_body_list_model.PRLines>[],
}) : super(key: key);
@override
@ -37,7 +40,7 @@ class RequestFragment extends StatelessWidget {
padding: const EdgeInsets.all(21),
children: [
if (moNotificationBodyList.isNotEmpty) moNotificationDataView(),
if (poLinesList.isNotEmpty) poLinesDataView(),
if (poLinesList.isNotEmpty) poLinesDataView(context),
if (itemCreationLines.isNotEmpty) itemCreationLinesView(),
if (prLinesList.isNotEmpty) prLinesDataView(),
],
@ -45,7 +48,7 @@ class RequestFragment extends StatelessWidget {
);
}
Widget poLinesDataView() {
Widget poLinesDataView(BuildContext context) {
return ExpandableNotifier(
child: ListView.separated(
shrinkWrap: true,
@ -87,22 +90,38 @@ class RequestFragment extends StatelessWidget {
12.height,
Row(
children: [
DefaultButton(LocaleKeys.itemHistory.tr(), () {
Navigator.pushNamed(
cxt,
AppRoutes.itemHistory,
arguments: ItemHistoryScreenParams(title: LocaleKeys.itemHistory.tr(), isMO: false, pItemId: poLinesList[index].iTEMID),
);
}).expanded,
DefaultButton(
LocaleKeys.itemHistory.tr(),
() {
Navigator.pushNamed(
cxt,
AppRoutes.itemHistory,
arguments: ItemHistoryScreenParams(title: LocaleKeys.itemHistory.tr(), isMO: false, pItemId: poLinesList[index].iTEMID),
);
},
fontSize: 13,
).expanded,
12.width,
DefaultButton(LocaleKeys.quotationAnalysis.tr(), () {
Navigator.pushNamed(
cxt,
AppRoutes.itemHistory,
arguments: ItemHistoryScreenParams(
isItemHistory: false, isMO: false, title: LocaleKeys.quotationAnalysis.tr(), pItemId: poLinesList[index].iTEMID, pPoHeaderId: poLinesList[index].pOHEADERID),
);
}).expanded,
DefaultButton(
LocaleKeys.quotationAnalysis.tr(),
() {
Navigator.pushNamed(
cxt,
AppRoutes.itemHistory,
arguments: ItemHistoryScreenParams(
isItemHistory: false, isMO: false, title: LocaleKeys.quotationAnalysis.tr(), pItemId: poLinesList[index].iTEMID, pPoHeaderId: poLinesList[index].pOHEADERID),
);
},
fontSize: 13,
).expanded,
12.width,
DefaultButton(
"PR Details",
() {
getPRDetails(context, poLinesList[index].pOLINEID.toString());
},
fontSize: 13,
).expanded,
],
)
],
@ -263,4 +282,23 @@ class RequestFragment extends StatelessWidget {
separatorBuilder: (cxt, index) => 12.height,
itemCount: itemCreationLines.length);
}
void getPRDetails(BuildContext context, String poLineID) async {
try {
Utils.showLoading(context);
GetPRInformationList? getPRInformationList = GetPRInformationList();
getPRInformationList = await WorkListApiClient().getPRDetailsForPO(poLineID);
Utils.hideLoading(context);
Navigator.pushNamed(
context,
AppRoutes.itemHistory,
arguments: ItemHistoryScreenParams(
isItemHistory: false, isMO: false, isPRInfo: true, getPRInformationList: getPRInformationList, title: "PR Details", pItemId: 0, pPoHeaderId: 0),
);
} catch (ex) {
Utils.hideLoading(context);
Utils.handleException(ex, context, null);
}
}
}

Loading…
Cancel
Save