Merge branch 'development_haroon' into 'master'

Development haroon

See merge request Cloud_Solution/mohemm-flutter-app!174
merge-requests/175/head
haroon amjad 3 years ago
commit bc06dc7912

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/app_state/app_state.dart';
import 'package:mohem_flutter_app/classes/consts.dart'; import 'package:mohem_flutter_app/classes/consts.dart';
import 'package:mohem_flutter_app/classes/date_uitl.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_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/get_attendance_tracking_list_model.dart';
import 'package:mohem_flutter_app/models/dashboard/itg_forms_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/generic_response_model.dart';
import 'package:mohem_flutter_app/models/itg/itg_main_response.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:mohem_flutter_app/models/itg/itg_response_model.dart';
import 'package:platform_device_id/platform_device_id.dart';
import 'package:uuid/uuid.dart'; import 'package:uuid/uuid.dart';
class DashboardApiClient { class DashboardApiClient {
@ -109,11 +107,12 @@ class DashboardApiClient {
//Mark Attendance //Mark Attendance
Future<GenericResponseModel?> markAttendance({String lat = "0", String? long = "0", required int pointType, String nfcValue = "", bool isGpsRequired = false, String QRValue = ""}) async { 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"; String url = "${ApiConsts.swpRest}AuthenticateAndSwipeUserSupportNFC";
// var uuid = Uuid(); var uuid = Uuid();
// Generate a v4 (random) id // Generate a v4 (random) id
Map<String, dynamic> postParams = { 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, "Latitude": lat,
"Longitude": long, "Longitude": long,
"QRValue": QRValue, "QRValue": QRValue,
@ -201,18 +200,18 @@ class DashboardApiClient {
}, url, postParams); }, url, postParams);
} }
Future setAdvertisementViewed(String masterID, int advertisementId) async { Future setAdvertisementViewed(String masterID, int advertisementId) async {
String url = "${ApiConsts.cocRest}Mohemm_ITG_UpdateAdvertisementAsViewed"; String url = "${ApiConsts.cocRest}Mohemm_ITG_UpdateAdvertisementAsViewed";
Map<String, dynamic> postParams = { Map<String, dynamic> postParams = {
"ItgNotificationMasterId": masterID, "ItgNotificationMasterId": masterID,
"EmployeeNumber": AppState().memberInformationList!.eMPLOYEENUMBER.toString(), "EmployeeNumber": AppState().memberInformationList!.eMPLOYEENUMBER.toString(),
"ItgAdvertisement": {"advertisementId": advertisementId, "acknowledgment": true} //Mobile Id "ItgAdvertisement": {"advertisementId": advertisementId, "acknowledgment": true} //Mobile Id
}; };
postParams.addAll(AppState().postParamsJson); postParams.addAll(AppState().postParamsJson);
return await ApiClient().postJsonForObject((json) { return await ApiClient().postJsonForObject((json) {
// ItgMainRes responseData = ItgMainRes.fromJson(json); // ItgMainRes responseData = ItgMainRes.fromJson(json);
return json; return json;
}, url, postParams); }, 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_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_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_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_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_quotation_analysis_list_model.dart';
import 'package:mohem_flutter_app/models/get_stamp_ms_notification_body_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; return responseData.updateUserItemTypesList;
}, url, postParams); }, 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 congratsGif = "assets/images/congrats.gif";
static const String loadingLottie = "assets/lottie/loading_lottie.json"; static const String loadingLottie = "assets/lottie/loading_lottie.json";
static const String noWinnerLottie = "assets/lottie/no_winner.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',
);
}
}

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

@ -394,20 +394,6 @@ class Utils {
} }
//HUAWEI DECISION MAKING //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 { static Future<bool> isGoogleServicesAvailable() async {
GooglePlayServicesAvailability availability = await GoogleApiAvailability.instance.checkGooglePlayServicesAvailability(); GooglePlayServicesAvailability availability = await GoogleApiAvailability.instance.checkGooglePlayServicesAvailability();
String status = availability.toString().split('.').last; 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_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_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_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_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_quotation_analysis_list_model.dart';
import 'package:mohem_flutter_app/models/get_schedule_shifts_details_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; List<GetPoItemHistoryList>? getPoItemHistoryList;
GetPoNotificationBodyList? getPoNotificationBodyList; GetPoNotificationBodyList? getPoNotificationBodyList;
GetPrNotificationBodyList? getPrNotificationBodyList; GetPrNotificationBodyList? getPrNotificationBodyList;
GetPRInformationList? getPRInformationList;
List<GetQuotationAnalysisList>? getQuotationAnalysisList; List<GetQuotationAnalysisList>? getQuotationAnalysisList;
List<GetRFCEmployeeList>? getRFCEmployeeListList; List<GetRFCEmployeeList>? getRFCEmployeeListList;
List<String>? getRespondAttributeValueList; List<String>? getRespondAttributeValueList;
@ -490,6 +492,7 @@ class GenericResponseModel {
this.getPoItemHistoryList, this.getPoItemHistoryList,
this.getPoNotificationBodyList, this.getPoNotificationBodyList,
this.getPrNotificationBodyList, this.getPrNotificationBodyList,
this.getPRInformationList,
this.getQuotationAnalysisList, this.getQuotationAnalysisList,
this.getRFCEmployeeListList, this.getRFCEmployeeListList,
this.getRespondAttributeValueList, this.getRespondAttributeValueList,
@ -979,6 +982,7 @@ class GenericResponseModel {
} }
getPoNotificationBodyList = json['GetPoNotificationBodyList'] != null ? GetPoNotificationBodyList.fromJson(json['GetPoNotificationBodyList']) : null; getPoNotificationBodyList = json['GetPoNotificationBodyList'] != null ? GetPoNotificationBodyList.fromJson(json['GetPoNotificationBodyList']) : null;
getPrNotificationBodyList = json['GetPrNotificationBodyList'] != null ? GetPrNotificationBodyList.fromJson(json['GetPrNotificationBodyList']) : 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) { if (json['GetQuotationAnalysisList'] != null) {
getQuotationAnalysisList = <GetQuotationAnalysisList>[]; getQuotationAnalysisList = <GetQuotationAnalysisList>[];
json['GetQuotationAnalysisList'].forEach((v) { json['GetQuotationAnalysisList'].forEach((v) {
@ -1602,6 +1606,10 @@ class GenericResponseModel {
data['GetPrNotificationBodyList'] = this.getPrNotificationBodyList!.toJson(); data['GetPrNotificationBodyList'] = this.getPrNotificationBodyList!.toJson();
} }
if (this.getPRInformationList != null) {
data['PR_Information_List'] = this.getPRInformationList!.toJson();
}
if (this.getQuotationAnalysisList != null) { if (this.getQuotationAnalysisList != null) {
data['GetQuotationAnalysisList'] = this.getQuotationAnalysisList!.map((v) => v.toJson()).toList(); data['GetQuotationAnalysisList'] = this.getQuotationAnalysisList!.map((v) => v.toJson()).toList();
} }

@ -158,6 +158,7 @@ class POLines {
String? nEEDBYDATE; String? nEEDBYDATE;
int? nOOFROWS; int? nOOFROWS;
int? pOHEADERID; int? pOHEADERID;
int? pOLINEID;
String? pROMISEDDATE; String? pROMISEDDATE;
String? pRNUM; String? pRNUM;
num? qUANTITY; num? qUANTITY;
@ -181,6 +182,7 @@ class POLines {
this.nEEDBYDATE, this.nEEDBYDATE,
this.nOOFROWS, this.nOOFROWS,
this.pOHEADERID, this.pOHEADERID,
this.pOLINEID,
this.pROMISEDDATE, this.pROMISEDDATE,
this.pRNUM, this.pRNUM,
this.qUANTITY, this.qUANTITY,
@ -204,6 +206,7 @@ class POLines {
nEEDBYDATE = json['NEED_BY_DATE']; nEEDBYDATE = json['NEED_BY_DATE'];
nOOFROWS = json['NO_OF_ROWS']; nOOFROWS = json['NO_OF_ROWS'];
pOHEADERID = json['PO_HEADER_ID']; pOHEADERID = json['PO_HEADER_ID'];
pOLINEID = json['PO_LINE_ID'];
pROMISEDDATE = json['PROMISED_DATE']; pROMISEDDATE = json['PROMISED_DATE'];
pRNUM = json['PR_NUM']; pRNUM = json['PR_NUM'];
qUANTITY = json['QUANTITY']; qUANTITY = json['QUANTITY'];
@ -229,6 +232,7 @@ class POLines {
data['NEED_BY_DATE'] = this.nEEDBYDATE; data['NEED_BY_DATE'] = this.nEEDBYDATE;
data['NO_OF_ROWS'] = this.nOOFROWS; data['NO_OF_ROWS'] = this.nOOFROWS;
data['PO_HEADER_ID'] = this.pOHEADERID; data['PO_HEADER_ID'] = this.pOHEADERID;
data['PO_LINE_ID'] = this.pOLINEID;
data['PROMISED_DATE'] = this.pROMISEDDATE; data['PROMISED_DATE'] = this.pROMISEDDATE;
data['PR_NUM'] = this.pRNUM; data['PR_NUM'] = this.pRNUM;
data['QUANTITY'] = this.qUANTITY; 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/api/chat/chat_api_client.dart';
import 'package:mohem_flutter_app/app_state/app_state.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/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/classes/utils.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';
@ -429,7 +430,7 @@ class ChatBubble extends StatelessWidget {
Widget getPlayer({required AudioPlayer player, required SingleUserChatModel modelData}) { Widget getPlayer({required AudioPlayer player, required SingleUserChatModel modelData}) {
return StreamBuilder<PlayerState>( return StreamBuilder<PlayerState>(
stream: player!.playerStateStream, stream: player.playerStateStream,
builder: (BuildContext context, AsyncSnapshot<PlayerState> snapshot) { builder: (BuildContext context, AsyncSnapshot<PlayerState> snapshot) {
PlayerState? playerState = snapshot.data; PlayerState? playerState = snapshot.data;
ProcessingState? processingState = playerState?.processingState; ProcessingState? processingState = playerState?.processingState;
@ -442,7 +443,7 @@ class ChatBubble extends StatelessWidget {
child: const CircularProgressIndicator(), child: const CircularProgressIndicator(),
); );
} else if (playing != true) { } else if (playing != true) {
return Icon( return const Icon(
Icons.play_arrow, Icons.play_arrow,
size: 30, size: 30,
color: MyColors.lightGreenColor, 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',
);
}
}

@ -244,25 +244,7 @@ class _DashboardScreenState extends State<DashboardScreen> with WidgetsBindingOb
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[ children: <Widget>[
LocaleKeys.welcomeBack.tr().toText14(color: MyColors.grey77Color), LocaleKeys.welcomeBack.tr().toText14(color: MyColors.grey77Color),
(AppState().memberInformationList!.eMPLOYEENAME ?? "").toText24(isBold: true).onPress(() async { (AppState().memberInformationList!.eMPLOYEENAME ?? "").toText24(isBold: true),
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),
),
),
),
);
}),
16.height, 16.height,
Row( Row(
children: [ children: [

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

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

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

@ -139,8 +139,8 @@ class _ItemForSaleDetailPageState extends State<ItemForSaleDetailPage> {
padding: const EdgeInsets.only(left: 8.0, right: 8.0), padding: const EdgeInsets.only(left: 8.0, right: 8.0),
child: ClipRRect( child: ClipRRect(
borderRadius: BorderRadius.circular(6), borderRadius: BorderRadius.circular(6),
child: Image.memory( child: Image.network(
base64Decode(element.content!), getItemsForSaleList.itemAttachments![0].filePath!,
fit: BoxFit.cover, 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/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_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_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/models/get_quotation_analysis_list_model.dart';
import 'package:mohem_flutter_app/widgets/app_bar_widget.dart'; import 'package:mohem_flutter_app/widgets/app_bar_widget.dart';
import 'package:mohem_flutter_app/widgets/item_detail_view_widget.dart'; import 'package:mohem_flutter_app/widgets/item_detail_view_widget.dart';
@ -18,8 +19,10 @@ class ItemHistoryScreenParams {
int? pItemId; int? pItemId;
int? pPoHeaderId; int? pPoHeaderId;
int? pOrgId; 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 { class ItemHistoryScreen extends StatefulWidget {
@ -51,7 +54,9 @@ class _ItemHistoryScreenState extends State<ItemHistoryScreen> {
void loadData() { void loadData() {
if (_screenParams == null) { if (_screenParams == null) {
_screenParams = ModalRoute.of(context)!.settings.arguments as ItemHistoryScreenParams; _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), padding: const EdgeInsets.all(21),
physics: const BouncingScrollPhysics(), physics: const BouncingScrollPhysics(),
children: [ children: [
if (_screenParams!.isPRInfo) prLinesDataView(),
if (moItemHistoryList.isNotEmpty) loadMoItemHistoryData(), if (moItemHistoryList.isNotEmpty) loadMoItemHistoryData(),
if (poItemHistoryList.isNotEmpty) loadPoItemHistoryData(), if (poItemHistoryList.isNotEmpty) loadPoItemHistoryData(),
if (quotationAnalysisList.isNotEmpty) loadQuotationAnalysisData(), 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() { Widget loadMoItemHistoryData() {
return ListView.separated( return ListView.separated(
shrinkWrap: true, shrinkWrap: true,

@ -1003,19 +1003,11 @@ class _WorkListDetailScreenState extends State<WorkListDetailScreen> {
try { try {
isActionHistoryLoaded = false; isActionHistoryLoaded = false;
actionHistoryList.clear(); actionHistoryList.clear();
// if (apiCallCount == 0) Utils.showLoading(context);
// apiCallCount++;
actionHistoryList = await WorkListApiClient().getActionHistory(workListData!.nOTIFICATIONID!); actionHistoryList = await WorkListApiClient().getActionHistory(workListData!.nOTIFICATIONID!);
// apiCallCount--;
// if (apiCallCount == 0) {
// Utils.hideLoading(context);
setState(() { setState(() {
isActionHistoryLoaded = true; isActionHistoryLoaded = true;
}); });
// }
} catch (ex) { } catch (ex) {
// apiCallCount--;
// Utils.hideLoading(context);
Utils.handleException(ex, context, null); Utils.handleException(ex, context, null);
} }
} }
@ -1024,88 +1016,15 @@ class _WorkListDetailScreenState extends State<WorkListDetailScreen> {
try { try {
isAttachmentLoaded = false; isAttachmentLoaded = false;
getAttachmentList.clear(); getAttachmentList.clear();
// if (apiCallCount == 0) Utils.showLoading(context);
// apiCallCount++;
getAttachmentList = await WorkListApiClient().getAttachments(workListData!.nOTIFICATIONID!); getAttachmentList = await WorkListApiClient().getAttachments(workListData!.nOTIFICATIONID!);
// apiCallCount--;
// if (apiCallCount == 0) {
// Utils.hideLoading(context);
setState(() { setState(() {
isAttachmentLoaded = true; isAttachmentLoaded = true;
}); });
// }
} catch (ex) { } catch (ex) {
// apiCallCount--;
// Utils.hideLoading(context);
Utils.handleException(ex, context, null); 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() { Widget showLoadingAnimation() {
return Lottie.asset( return Lottie.asset(
'assets/lottie/loading.json', 'assets/lottie/loading.json',

@ -1,7 +1,9 @@
import 'package:easy_localization/src/public_ext.dart'; import 'package:easy_localization/src/public_ext.dart';
import 'package:expandable/expandable.dart'; import 'package:expandable/expandable.dart';
import 'package:flutter/material.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/colors.dart';
import 'package:mohem_flutter_app/classes/utils.dart';
import 'package:mohem_flutter_app/config/routes.dart'; import 'package:mohem_flutter_app/config/routes.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';
@ -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_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_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_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/ui/work_list/item_history_screen.dart';
import 'package:mohem_flutter_app/widgets/button/default_button.dart'; import 'package:mohem_flutter_app/widgets/button/default_button.dart';
import 'package:mohem_flutter_app/widgets/item_detail_view_widget.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<GetMoNotificationBodyList> moNotificationBodyList;
final List<ItemCreationLines> itemCreationLines; final List<ItemCreationLines> itemCreationLines;
final List<POLines> poLinesList; final List<POLines> poLinesList;
final List<PRLines> prLinesList; final List<get_pr_notification_body_list_model.PRLines> prLinesList;
RequestFragment({ RequestFragment({
Key? key, Key? key,
this.moNotificationBodyList = const <GetMoNotificationBodyList>[], this.moNotificationBodyList = const <GetMoNotificationBodyList>[],
this.itemCreationLines = const <ItemCreationLines>[], this.itemCreationLines = const <ItemCreationLines>[],
this.poLinesList = const <POLines>[], this.poLinesList = const <POLines>[],
this.prLinesList = const <PRLines>[], this.prLinesList = const <get_pr_notification_body_list_model.PRLines>[],
}) : super(key: key); }) : super(key: key);
@override @override
@ -37,7 +40,7 @@ class RequestFragment extends StatelessWidget {
padding: const EdgeInsets.all(21), padding: const EdgeInsets.all(21),
children: [ children: [
if (moNotificationBodyList.isNotEmpty) moNotificationDataView(), if (moNotificationBodyList.isNotEmpty) moNotificationDataView(),
if (poLinesList.isNotEmpty) poLinesDataView(), if (poLinesList.isNotEmpty) poLinesDataView(context),
if (itemCreationLines.isNotEmpty) itemCreationLinesView(), if (itemCreationLines.isNotEmpty) itemCreationLinesView(),
if (prLinesList.isNotEmpty) prLinesDataView(), if (prLinesList.isNotEmpty) prLinesDataView(),
], ],
@ -45,7 +48,7 @@ class RequestFragment extends StatelessWidget {
); );
} }
Widget poLinesDataView() { Widget poLinesDataView(BuildContext context) {
return ExpandableNotifier( return ExpandableNotifier(
child: ListView.separated( child: ListView.separated(
shrinkWrap: true, shrinkWrap: true,
@ -87,22 +90,38 @@ class RequestFragment extends StatelessWidget {
12.height, 12.height,
Row( Row(
children: [ children: [
DefaultButton(LocaleKeys.itemHistory.tr(), () { DefaultButton(
Navigator.pushNamed( LocaleKeys.itemHistory.tr(),
cxt, () {
AppRoutes.itemHistory, Navigator.pushNamed(
arguments: ItemHistoryScreenParams(title: LocaleKeys.itemHistory.tr(), isMO: false, pItemId: poLinesList[index].iTEMID), cxt,
); AppRoutes.itemHistory,
}).expanded, arguments: ItemHistoryScreenParams(title: LocaleKeys.itemHistory.tr(), isMO: false, pItemId: poLinesList[index].iTEMID),
);
},
fontSize: 13,
).expanded,
12.width, 12.width,
DefaultButton(LocaleKeys.quotationAnalysis.tr(), () { DefaultButton(
Navigator.pushNamed( LocaleKeys.quotationAnalysis.tr(),
cxt, () {
AppRoutes.itemHistory, Navigator.pushNamed(
arguments: ItemHistoryScreenParams( cxt,
isItemHistory: false, isMO: false, title: LocaleKeys.quotationAnalysis.tr(), pItemId: poLinesList[index].iTEMID, pPoHeaderId: poLinesList[index].pOHEADERID), AppRoutes.itemHistory,
); arguments: ItemHistoryScreenParams(
}).expanded, 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, separatorBuilder: (cxt, index) => 12.height,
itemCount: itemCreationLines.length); 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