merge-requests/65/head
Sultan khan 2 years ago
commit ee553ae476

2
.gitignore vendored

@ -34,7 +34,6 @@ pubspec.lock
/build/
# Web related
lib/generated_plugin_registrant.dart
# Symbolication related
app.*.symbols
@ -46,3 +45,4 @@ app.*.map.json
/android/app/debug
/android/app/profile
/android/app/release
/ios/

@ -0,0 +1,3 @@
<svg xmlns="http://www.w3.org/2000/svg" width="21.279" height="22.831" viewBox="0 0 21.279 22.831">
<path id="Path_4751" data-name="Path 4751" d="M19.767,15.891c-1.379-1.18-2.779-1.894-4.141-.716l-.813.712c-.6.517-1.7,2.931-5.98-1.99S7.1,8.215,7.7,7.7l.818-.713c1.355-1.181.844-2.667-.134-4.2l-.59-.927C6.809.34,5.739-.662,4.381.517l-.734.642A6.892,6.892,0,0,0,.96,5.719c-.49,3.241,1.056,6.953,4.6,11.026s7,6.121,10.281,6.085a6.91,6.91,0,0,0,4.888-2.024l.737-.642c1.355-1.178.513-2.377-.867-3.559Z" transform="translate(-0.872 0)" fill="#2bb8a6"/>
</svg>

After

Width:  |  Height:  |  Size: 557 B

@ -0,0 +1,54 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- Generator: Adobe Illustrator 19.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
<path style="fill:#E2E5E7;" d="M128,0c-17.6,0-32,14.4-32,32v448c0,17.6,14.4,32,32,32h320c17.6,0,32-14.4,32-32V128L352,0H128z"/>
<path style="fill:#B0B7BD;" d="M384,128h96L352,0v96C352,113.6,366.4,128,384,128z"/>
<polygon style="fill:#CAD1D8;" points="480,224 384,128 480,128 "/>
<path style="fill:#50BEE8;" d="M416,416c0,8.8-7.2,16-16,16H48c-8.8,0-16-7.2-16-16V256c0-8.8,7.2-16,16-16h352c8.8,0,16,7.2,16,16
V416z"/>
<g>
<path style="fill:#FFFFFF;" d="M92.576,384c-4.224,0-8.832-2.32-8.832-7.936v-72.656c0-4.608,4.608-7.936,8.832-7.936h29.296
c58.464,0,57.168,88.528,1.136,88.528H92.576z M100.64,311.072v57.312h21.232c34.544,0,36.064-57.312,0-57.312H100.64z"/>
<path style="fill:#FFFFFF;" d="M228,385.28c-23.664,1.024-48.24-14.72-48.24-46.064c0-31.472,24.56-46.944,48.24-46.944
c22.384,1.136,45.792,16.624,45.792,46.944C273.792,369.552,250.384,385.28,228,385.28z M226.592,308.912
c-14.336,0-29.936,10.112-29.936,30.32c0,20.096,15.616,30.336,29.936,30.336c14.72,0,30.448-10.24,30.448-30.336
C257.04,319.008,241.312,308.912,226.592,308.912z"/>
<path style="fill:#FFFFFF;" d="M288.848,339.088c0-24.688,15.488-45.92,44.912-45.92c11.136,0,19.968,3.328,29.296,11.392
c3.456,3.184,3.84,8.816,0.384,12.4c-3.456,3.056-8.704,2.688-11.776-0.384c-5.232-5.504-10.608-7.024-17.904-7.024
c-19.696,0-29.152,13.952-29.152,29.552c0,15.872,9.328,30.448,29.152,30.448c7.296,0,14.08-2.96,19.968-8.192
c3.952-3.072,9.456-1.552,11.76,1.536c2.048,2.816,3.056,7.552-1.408,12.016c-8.96,8.336-19.696,10-30.336,10
C302.8,384.912,288.848,363.776,288.848,339.088z"/>
</g>
<path style="fill:#CAD1D8;" d="M400,432H96v16h304c8.8,0,16-7.2,16-16v-16C416,424.8,408.8,432,400,432z"/>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.1 KiB

@ -0,0 +1,51 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- Generator: Adobe Illustrator 19.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
<path style="fill:#E2E5E7;" d="M128,0c-17.6,0-32,14.4-32,32v448c0,17.6,14.4,32,32,32h320c17.6,0,32-14.4,32-32V128L352,0H128z"/>
<path style="fill:#B0B7BD;" d="M384,128h96L352,0v96C352,113.6,366.4,128,384,128z"/>
<polygon style="fill:#CAD1D8;" points="480,224 384,128 480,128 "/>
<path style="fill:#F15642;" d="M416,416c0,8.8-7.2,16-16,16H48c-8.8,0-16-7.2-16-16V256c0-8.8,7.2-16,16-16h352c8.8,0,16,7.2,16,16
V416z"/>
<g>
<path style="fill:#FFFFFF;" d="M105.456,303.152c0-4.224,3.328-8.832,8.688-8.832h29.552c16.64,0,31.616,11.136,31.616,32.48
c0,20.224-14.976,31.488-31.616,31.488h-21.36v16.896c0,5.632-3.568,8.816-8.176,8.816c-4.224,0-8.688-3.184-8.688-8.816v-72.032
H105.456z M122.336,310.432v31.872h21.36c8.576,0,15.36-7.568,15.36-15.504c0-8.944-6.784-16.368-15.36-16.368H122.336z"/>
<path style="fill:#FFFFFF;" d="M191.616,303.152c0-4.224,3.328-8.832,8.704-8.832h29.552c16.64,0,31.616,11.136,31.616,32.48
c0,20.224-14.976,31.488-31.616,31.488h-21.36v16.896c0,5.632-3.584,8.816-8.192,8.816c-4.224,0-8.704-3.184-8.704-8.816V303.152z
M208.496,310.432v31.872h21.36c8.576,0,15.36-7.568,15.36-15.504c0-8.944-6.784-16.368-15.36-16.368H208.496z"/>
<path style="fill:#FFFFFF;" d="M301.68,311.472h-22.368c-11.136,0-11.136-16.368,0-16.368h60.496c11.392,0,11.392,16.368,0,16.368
h-21.232v64.608c0,11.12-16.896,11.392-16.896,0V311.472z"/>
</g>
<path style="fill:#CAD1D8;" d="M400,432H96v16h304c8.8,0,16-7.2,16-16v-16C416,424.8,408.8,432,400,432z"/>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.9 KiB

@ -0,0 +1,51 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- Generator: Adobe Illustrator 19.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
<path style="fill:#E2E5E7;" d="M128,0c-17.6,0-32,14.4-32,32v448c0,17.6,14.4,32,32,32h320c17.6,0,32-14.4,32-32V128L352,0H128z"/>
<path style="fill:#B0B7BD;" d="M384,128h96L352,0v96C352,113.6,366.4,128,384,128z"/>
<polygon style="fill:#CAD1D8;" points="480,224 384,128 480,128 "/>
<path style="fill:#576D7E;" d="M416,416c0,8.8-7.2,16-16,16H48c-8.8,0-16-7.2-16-16V256c0-8.8,7.2-16,16-16h352c8.8,0,16,7.2,16,16
V416z"/>
<g>
<path style="fill:#FFFFFF;" d="M132.784,311.472H110.4c-11.136,0-11.136-16.368,0-16.368h60.512c11.392,0,11.392,16.368,0,16.368
h-21.248v64.592c0,11.12-16.896,11.392-16.896,0v-64.592H132.784z"/>
<path style="fill:#FFFFFF;" d="M224.416,326.176l22.272-27.888c6.656-8.688,19.568,2.432,12.288,10.752
c-7.68,9.088-15.728,18.944-23.424,29.024l26.112,32.496c7.024,9.6-7.04,18.816-13.952,9.344l-23.536-30.192l-23.152,30.832
c-6.528,9.328-20.992-1.152-13.68-9.856l25.696-32.624c-8.048-10.096-15.856-19.936-23.664-29.024
c-8.064-9.6,6.912-19.44,12.784-10.48L224.416,326.176z"/>
<path style="fill:#FFFFFF;" d="M298.288,311.472H275.92c-11.136,0-11.136-16.368,0-16.368h60.496c11.392,0,11.392,16.368,0,16.368
h-21.232v64.592c0,11.12-16.896,11.392-16.896,0V311.472z"/>
</g>
<path style="fill:#CAD1D8;" d="M400,432H96v16h304c8.8,0,16-7.2,16-16v-16C416,424.8,408.8,432,400,432z"/>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.8 KiB

@ -0,0 +1,6 @@
<svg xmlns="http://www.w3.org/2000/svg" width="27.826" height="17.898" viewBox="0 0 27.826 17.898">
<g id="video-call" transform="translate(-10 -18)">
<rect id="Rectangle_17475" data-name="Rectangle 17475" width="21.057" height="17.898" rx="3" transform="translate(10 18)" fill="#2bb8a6"/>
<path id="Path_4752" data-name="Path 4752" d="M50.692,21.633V34.282a.635.635,0,0,1-.316.55.622.622,0,0,1-.316.082.638.638,0,0,1-.316-.082L45,32.1V23.815l4.743-2.732a.66.66,0,0,1,.632,0A.635.635,0,0,1,50.692,21.633Z" transform="translate(-12.866 -1.104)" fill="#2bb8a6"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 585 B

@ -0,0 +1,53 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- Generator: Adobe Illustrator 19.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
<path style="fill:#E2E5E7;" d="M128,0c-17.6,0-32,14.4-32,32v448c0,17.6,14.4,32,32,32h320c17.6,0,32-14.4,32-32V128L352,0H128z"/>
<path style="fill:#B0B7BD;" d="M384,128h96L352,0v96C352,113.6,366.4,128,384,128z"/>
<polygon style="fill:#CAD1D8;" points="480,224 384,128 480,128 "/>
<path style="fill:#84BD5A;" d="M416,416c0,8.8-7.2,16-16,16H48c-8.8,0-16-7.2-16-16V256c0-8.8,7.2-16,16-16h352c8.8,0,16,7.2,16,16
V416z"/>
<g>
<path style="fill:#FFFFFF;" d="M144.336,326.192l22.256-27.888c6.656-8.704,19.584,2.416,12.288,10.736
c-7.664,9.088-15.728,18.944-23.408,29.04l26.096,32.496c7.04,9.6-7.024,18.8-13.936,9.328l-23.552-30.192l-23.152,30.848
c-6.528,9.328-20.992-1.152-13.696-9.856l25.712-32.624c-8.064-10.112-15.872-19.952-23.664-29.04
c-8.048-9.6,6.912-19.44,12.8-10.464L144.336,326.192z"/>
<path style="fill:#FFFFFF;" d="M197.36,303.152c0-4.224,3.584-7.808,8.064-7.808c4.096,0,7.552,3.6,7.552,7.808v64.096h34.8
c12.528,0,12.8,16.752,0,16.752H205.44c-4.48,0-8.064-3.184-8.064-7.792v-73.056H197.36z"/>
<path style="fill:#FFFFFF;" d="M272.032,314.672c2.944-24.832,40.416-29.296,58.08-15.728c8.704,7.024-0.512,18.16-8.192,12.528
c-9.472-6-30.96-8.816-33.648,4.464c-3.456,20.992,52.192,8.976,51.296,43.008c-0.896,32.496-47.968,33.248-65.632,18.672
c-4.24-3.456-4.096-9.072-1.792-12.544c3.328-3.312,7.024-4.464,11.392-0.88c10.48,7.152,37.488,12.528,39.392-5.648
C321.28,339.632,268.064,351.008,272.032,314.672z"/>
</g>
<path style="fill:#CAD1D8;" d="M400,432H96v16h304c8.8,0,16-7.2,16-16v-16C416,424.8,408.8,432,400,432z"/>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.0 KiB

@ -0,0 +1,51 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- Generator: Adobe Illustrator 19.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
<path style="fill:#E2E5E7;" d="M128,0c-17.6,0-32,14.4-32,32v448c0,17.6,14.4,32,32,32h320c17.6,0,32-14.4,32-32V128L352,0H128z"/>
<path style="fill:#B0B7BD;" d="M384,128h96L352,0v96C352,113.6,366.4,128,384,128z"/>
<polygon style="fill:#CAD1D8;" points="480,224 384,128 480,128 "/>
<path style="fill:#84BD5A;" d="M416,416c0,8.8-7.2,16-16,16H48c-8.8,0-16-7.2-16-16V256c0-8.8,7.2-16,16-16h352c8.8,0,16,7.2,16,16
V416z"/>
<g>
<path style="fill:#FFFFFF;" d="M132.64,384c-8.064,0-11.264-7.792-6.656-13.296l45.552-60.512h-37.76
c-11.12,0-10.224-15.712,0-15.712h51.568c9.712,0,12.528,9.184,5.632,16.624l-43.632,56.656h41.584
c10.24,0,11.52,16.256-1.008,16.256h-55.28V384z"/>
<path style="fill:#FFFFFF;" d="M212.048,303.152c0-10.496,16.896-10.88,16.896,0v73.04c0,10.608-16.896,10.88-16.896,0V303.152z"/>
<path style="fill:#FFFFFF;" d="M251.616,303.152c0-4.224,3.328-8.832,8.704-8.832h29.552c16.64,0,31.616,11.136,31.616,32.48
c0,20.224-14.976,31.488-31.616,31.488h-21.36v16.896c0,5.632-3.584,8.816-8.192,8.816c-4.224,0-8.704-3.184-8.704-8.816
L251.616,303.152L251.616,303.152z M268.496,310.432v31.872h21.36c8.576,0,15.36-7.568,15.36-15.504
c0-8.944-6.784-16.368-15.36-16.368H268.496z"/>
</g>
<path style="fill:#CAD1D8;" d="M400,432H96v16h304c8.8,0,16-7.2,16-16v-16C416,424.8,408.8,432,400,432z"/>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.8 KiB

@ -498,5 +498,7 @@
"verification": "تَحَقّق",
"resend": "إعادة إرسال",
"codeExpire": "انتهت صلاحية رمز التحقق",
"typeheretoreply": "اكتب هنا للرد"
"typeheretoreply": "اكتب هنا للرد",
"favorite": "مفضلتي",
"searchfromchat": "البحث من الدردشة"
}

@ -498,5 +498,8 @@
"resend": "Resend",
"codeExpire": "The verification code has been expired",
"allQuestionsCorrect": "You have answered all questions correct",
"typeheretoreply": "Type here to reply"
"typeheretoreply": "Type here to reply",
"favorite" : "My Favorites",
"searchfromchat": "Search from chat"
}

@ -383,7 +383,7 @@
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
DEVELOPMENT_TEAM = 3A359E86ZF;
DEVELOPMENT_TEAM = 99Z3UD3LJM;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist;
INFOPLIST_KEY_CFBundleDisplayName = Mohemm;
@ -520,7 +520,7 @@
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
DEVELOPMENT_TEAM = 3A359E86ZF;
DEVELOPMENT_TEAM = 99Z3UD3LJM;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist;
INFOPLIST_KEY_CFBundleDisplayName = Mohemm;
@ -549,7 +549,7 @@
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
DEVELOPMENT_TEAM = 3A359E86ZF;
DEVELOPMENT_TEAM = 99Z3UD3LJM;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist;
INFOPLIST_KEY_CFBundleDisplayName = Mohemm;

@ -44,6 +44,8 @@
<string>This App requires access to your location to mark your attendance.</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>This app requires photo library access to select image as document &amp; upload it.</string>
<key>NSMicrophoneUsageDescription</key>
<string>This app requires microphone access to for call.</string>
<key>UIBackgroundModes</key>
<array>
<string>remote-notification</string>

@ -1,37 +1,71 @@
import 'dart:async';
import 'dart:convert';
import 'dart:io';
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/foundation.dart';
import 'package:fluttertoast/fluttertoast.dart';
import 'package:http/http.dart';
import 'package:logger/logger.dart' as L;
import 'package:logging/logging.dart';
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/utils.dart';
import 'package:mohem_flutter_app/models/chat/get_search_user_chat_model.dart';
import 'package:mohem_flutter_app/models/chat/get_single_user_chat_list_Model.dart';
import 'package:mohem_flutter_app/models/chat/get_single_user_chat_list_model.dart';
import 'package:mohem_flutter_app/models/chat/get_user_login_token_model.dart' as login;
import 'package:shared_preferences/shared_preferences.dart';
import 'package:mohem_flutter_app/models/chat/make_user_favotire_unfavorite_chat_model.dart' as fav;
import 'package:mohem_flutter_app/widgets/image_picker.dart';
import 'package:signalr_netcore/signalr_client.dart';
import 'package:logger/logger.dart' as L;
import 'package:uuid/uuid.dart';
class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
ScrollController scrollController = ScrollController();
TextEditingController message = TextEditingController();
TextEditingController search = TextEditingController();
List<SingleUserChatModel> userChatHistory = [];
List<ChatUser>? pChatHistory, searchedChats;
late HubConnection hubConnection;
L.Logger logger = L.Logger();
TextEditingController message = TextEditingController();
ScrollController scrollController = ScrollController();
bool hubConInitialized = false;
bool isLoading = true;
bool isChatScreenActive = false;
late File selectedFile;
bool isFileSelected = false;
String sFileType = "";
bool isMsgReply = false;
List<SingleUserChatModel> repliedMsg = [];
List<ChatUser> favUsersList = [];
int paginationVal = 0;
//Scroll
bool _firstAutoscrollExecuted = false;
bool _shouldAutoscroll = false;
Future<void> getUserAutoLoginToken() async {
String userName = AppState().memberInformationList!.eMPLOYEEEMAILADDRESS!.split("@").first.toString();
Response response =
await ApiClient().postJsonForResponse("${ApiConsts.chatServerBaseApiUrl}user/desktopuserlogin", {"userName": userName, "password": "FxIu26rWIKoF8n6mpbOmAjDLphzFGmpG", "loginType": 2});
login.UserAutoLoginModel userLoginResponse = login.userAutoLoginModelFromJson(response.body);
AppState().setchatUserDetails = userLoginResponse;
await buildHubConnection();
Response response = await ApiClient().postJsonForResponse(
"${ApiConsts.chatServerBaseApiUrl}user/externaluserlogin",
{
"employeeNumber": int.parse(
AppState().memberInformationList!.eMPLOYEENUMBER.toString(),
),
"password": "FxIu26rWIKoF8n6mpbOmAjDLphzFGmpG"
},
);
login.UserAutoLoginModel userLoginResponse = login.userAutoLoginModelFromJson(
response.body,
);
if (userLoginResponse.response != null) {
hubConInitialized = true;
AppState().setchatUserDetails = userLoginResponse;
await buildHubConnection();
} else {
Utils.showToast(userLoginResponse.errorResponses!.first.fieldName.toString() + " Erorr");
return;
}
}
Future<List<ChatUser>?> getChatMemberFromSearch(String sName, int cUserId) async {
@ -40,9 +74,6 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
token: AppState().chatDetails!.response!.token,
);
return searchUserJsonModel(response.body);
logger.d(response.body);
isLoading = false;
notifyListeners();
}
List<ChatUser> searchUserJsonModel(String str) => List<ChatUser>.from(json.decode(str).map((x) => ChatUser.fromJson(x)));
@ -53,80 +84,127 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
token: AppState().chatDetails!.response!.token,
);
ChatUserModel recentChat = userToList(response.body);
pChatHistory = recentChat.response;
Response favRes = await ApiClient().getJsonForResponse(
"${ApiConsts.chatServerBaseApiUrl}${ApiConsts.chatFavoriteUsers}${AppState().chatDetails!.response!.id}",
token: AppState().chatDetails!.response!.token,
);
ChatUserModel favUList = userToList(favRes.body);
if (favUList.response != null) {
favUsersList = favUList.response!;
favUsersList.sort((ChatUser a, ChatUser b) => a.userName!.toLowerCase().compareTo(b.userName!.toLowerCase()));
for (dynamic user in recentChat.response!) {
for (dynamic favUser in favUList.response!) {
if (user.id == favUser.id) {
user.isFav = favUser.isFav;
}
}
}
}
pChatHistory = recentChat.response == null ? [] : recentChat.response;
if (pChatHistory != null) pChatHistory!.sort((ChatUser a, ChatUser b) => a.userName!.toLowerCase().compareTo(b.userName!.toLowerCase()));
searchedChats = pChatHistory;
isLoading = false;
notifyListeners();
}
void getSingleUserChatHistory({required String senderUID, required int receiverUID, required String pagination}) async {
Future GetUserChatHistoryNotDeliveredAsync(int userId) async {
await hubConnection.invoke("GetUserChatHistoryNotDeliveredAsync", args: [userId]);
return "";
}
void getSingleUserChatHistory({required int senderUID, required int receiverUID, required bool loadMore, bool isNewChat = false}) async {
isLoading = true;
if (isNewChat) userChatHistory = [];
if (!loadMore) paginationVal = 0;
isChatScreenActive = true;
Response response = await ApiClient().getJsonForResponse(
"${ApiConsts.chatServerBaseApiUrl}${ApiConsts.chatSingleUserHistoryUrl}/$senderUID/$receiverUID/$pagination",
"${ApiConsts.chatServerBaseApiUrl}${ApiConsts.chatSingleUserHistoryUrl}/$senderUID/$receiverUID/$paginationVal",
token: AppState().chatDetails!.response!.token,
);
logger.d(response.statusCode);
print(response.body);
if (response.statusCode == 204) {
userChatHistory = [];
if (isNewChat) {
userChatHistory = [];
} else if (loadMore) {
// userChatHistory = [];
Utils.showToast("No More Data To Load");
}
} else {
userChatHistory = getSingleUserChatModel(response.body);
if (loadMore) {
List<SingleUserChatModel> temp = getSingleUserChatModel(response.body).reversed.toList();
userChatHistory.addAll(temp);
} else {
userChatHistory = getSingleUserChatModel(response.body).reversed.toList();
}
}
isLoading = false;
await GetUserChatHistoryNotDeliveredAsync(senderUID);
notifyListeners();
}
void updateUserChatHistoryStatusAsync(List data) {
hubConnection.invoke("UpdateUserChatHistoryStatusAsync", args: [data]);
}
List<SingleUserChatModel> getSingleUserChatModel(String str) => List<SingleUserChatModel>.from(json.decode(str).map((x) => SingleUserChatModel.fromJson(x)));
ChatUserModel userToList(String str) => ChatUserModel.fromJson(json.decode(str));
Future<dynamic> uploadAttachments(String userId, File file) async {
dynamic result;
dynamic request = MultipartRequest('POST', Uri.parse('${ApiConsts.chatServerBaseApiUrl}${ApiConsts.chatMediaImageUploadUrl}'));
request.fields.addAll({'userId': userId, 'fileSource': '1'});
request.files.add(await MultipartFile.fromPath('files', file.path));
request.headers.addAll({'Authorization': 'Bearer ${AppState().chatDetails!.response!.token}'});
try {
StreamedResponse response = await request.send();
if (response.statusCode == 200) {
result = jsonDecode(await response.stream.bytesToString());
} else {
result = [];
}
} catch (e) {
if (kDebugMode) {
print(e);
}
}
;
return result;
}
Future<void> buildHubConnection() async {
HttpConnectionOptions httpOp = HttpConnectionOptions(skipNegotiation: false, logMessageContent: true);
hubConnection = await HubConnectionBuilder()
hubConnection = HubConnectionBuilder()
.withUrl(ApiConsts.chatHubConnectionUrl + "?UserId=${AppState().chatDetails!.response!.id}&source=Web&access_token=${AppState().chatDetails!.response!.token}", options: httpOp)
.withAutomaticReconnect(retryDelays: [2000, 5000, 10000, 20000])
.withAutomaticReconnect(
retryDelays: <int>[2000, 5000, 10000, 20000],
)
.configureLogging(
Logger("Logs Enabled"),
Logger("Loggin"),
)
.build();
hubConnection.onclose(
({Exception? error}) {
// logger.d(error);
},
({Exception? error}) {},
);
hubConnection.onreconnecting(
({Exception? error}) {
// logger.d(error);
// logger.d("Reconnecting");
},
({Exception? error}) {},
);
hubConnection.onreconnected(
({String? connectionId}) {
// logger.d("Reconnected");
},
({String? connectionId}) {},
);
if (hubConnection.state != HubConnectionState.Connected) {
await hubConnection.start();
hubConnection.on("OnUpdateUserStatusAsync", changeStatus);
hubConnection.on("OnDeliveredChatUserAsync", onMsgReceived);
// hubConnection.on("OnSeenChatUserAsync", onChatSeen);
hubConnection.on("OnUserTypingAsync", onUserTyping);
// hubConnection.on("OnUserCountAsync", userCountAsync);
// hubConnection.on("OnUpdateUserChatHistoryWindowsAsync", updateChatHistoryWindow);
// hubConnection.on("OnGetUserChatHistoryNotDeliveredAsync", chatNotDelivered);
hubConnection.on("OnUpdateUserChatHistoryStatusAsync", updateUserChatStatus);
} else {
hubConnection.on("OnUpdateUserStatusAsync", changeStatus);
hubConnection.on("OnDeliveredChatUserAsync", onMsgReceived);
hubConnection.on("OnUserTypingAsync", onUserTyping);
// hubConnection.on("OnUserCountAsync", userCountAsync);
// hubConnection.on("OnUpdateUserChatHistoryWindowsAsync", updateChatHistoryWindow);
// hubConnection.on("OnGetUserChatHistoryNotDeliveredAsync", chatNotDelivered);
//hubConnection.on("OnUserTypingAsync", onUserTyping);
hubConnection.on("OnUserCountAsync", userCountAsync);
hubConnection.on("OnUpdateUserChatHistoryWindowsAsync", updateChatHistoryWindow);
hubConnection.on("OnGetUserChatHistoryNotDeliveredAsync", chatNotDelivered);
hubConnection.on("OnUpdateUserChatHistoryStatusAsync", updateUserChatStatus);
}
isLoading = false;
notifyListeners();
}
void updateUserChatStatus(List<Object?>? args) {
@ -134,7 +212,6 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
for (dynamic cItem in items[0]) {
for (SingleUserChatModel chat in userChatHistory) {
if (chat.userChatHistoryId.toString() == cItem["userChatHistoryId"].toString()) {
logger.d(jsonEncode(chat));
chat.isSeen = cItem["isSeen"];
chat.isDelivered = cItem["isDelivered"];
notifyListeners();
@ -143,9 +220,9 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
}
}
void userCountAsync(List<Object?>? args) {
List items = args!.toList();
print("---------------------------------User Count Async -------------------------------------");
void onChatSeen(List<Object?>? args) {
dynamic items = args!.toList();
logger.d("---------------------------------Chat Seen -------------------------------------");
logger.d(items);
// for (var user in searchedChats!) {
// if (user.id == items.first["id"]) {
@ -155,8 +232,21 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
// notifyListeners();
}
void userCountAsync(List<Object?>? args) {
dynamic items = args!.toList();
// logger.d(items);
//logger.d("---------------------------------User Count Async -------------------------------------");
//logger.d(items);
// for (var user in searchedChats!) {
// if (user.id == items.first["id"]) {
// user.userStatus = items.first["userStatus"];
// }
// }
// notifyListeners();
}
void updateChatHistoryWindow(List<Object?>? args) {
List items = args!.toList();
dynamic items = args!.toList();
print("---------------------------------Update Chat History Windows Async -------------------------------------");
logger.d(items);
// for (var user in searchedChats!) {
@ -168,20 +258,32 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
}
void chatNotDelivered(List<Object?>? args) {
List items = args!.toList();
print("--------------------------------- Chat Not Delivered Windows Async -------------------------------------");
dynamic items = args!.toList();
for (dynamic item in items[0]) {
dynamic data = [
{
"userChatHistoryId": item["userChatHistoryId"],
"TargetUserId": item["targetUserId"],
"isDelivered": true,
"isSeen": true,
}
];
updateUserChatHistoryStatusAsync(data);
}
logger.d(items);
// for (var user in searchedChats!) {
// if (user.id == items.first["id"]) {
// user.userStatus = items.first["userStatus"];
// }
// }
// notifyListeners();
// notifyListeners();2
}
void changeStatus(List<Object?>? args) {
// print("================= Status Online // Offline ====================");
List items = args!.toList();
if (kDebugMode) {
// print("================= Status Online // Offline ====================");
}
dynamic items = args!.toList();
// logger.d(items);
for (ChatUser user in searchedChats!) {
if (user.id == items.first["id"]) {
@ -217,18 +319,34 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
data.first.currentUserId = temp.first.targetUserId;
data.first.currentUserName = temp.first.targetUserName;
}
userChatHistory.add(data.first);
userChatHistory.insert(0, data.first);
// searchedChats!.forEach((element) {
// if (element.id == data.first.currentUserId) {
// var val = element.unreadMessageCount == null ? 0 : element.unreadMessageCount;
// element.unreadMessageCount = val! + 1;
// }
// });
var list = [
{
"userChatHistoryId": data.first.userChatHistoryId,
"TargetUserId": data.first.targetUserId,
"isDelivered": true,
"isSeen": isChatScreenActive ? true : false,
}
];
updateUserChatHistoryStatusAsync(list);
notifyListeners();
scrollDown();
// if (isChatScreenActive) scrollToBottom();
}
void onUserTyping(List<Object?>? parameters) {
print("==================== Typing Active ==================");
logger.d(parameters);
// print("==================== Typing Active ==================");
// logger.d(parameters);
for (ChatUser user in searchedChats!) {
if (user.id == parameters![1] && parameters[0] == true) {
user.isTyping = parameters[0] as bool?;
Future.delayed(
const Duration(seconds: 2),
() {
@ -241,12 +359,114 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
notifyListeners();
}
void sendChatMessage(String chatMessage, int targetUserId, String targetUserName) async {
if (chatMessage == null || chatMessage.isEmpty) {
return;
int getFileType(String value) {
switch (value) {
case ".pdf":
return 1;
case ".png":
return 3;
case ".txt":
return 5;
case ".jpg":
return 12;
case ".jpeg":
return 4;
case ".xls":
return 7;
case ".xlsx":
return 7;
case ".doc":
return 6;
case ".docx":
return 6;
case ".ppt":
return 8;
case ".pptx":
return 8;
case ".zip":
return 2;
case ".rar":
return 2;
default:
return 0;
}
}
String getFileTypeDescription(String value) {
switch (value) {
case ".pdf":
return "application/pdf";
case ".png":
return "image/png";
case ".txt":
return "text/plain";
case ".jpg":
return "image/jpg";
case ".jpeg":
return "image/jpeg";
case ".ppt":
return "application/vnd.openxmlformats-officedocument.presentationml.presentation";
case ".pptx":
return "application/vnd.openxmlformats-officedocument.presentationml.presentation";
case ".doc":
return "application/vnd.openxmlformats-officedocument.wordprocessingm";
case ".docx":
return "application/vnd.openxmlformats-officedocument.wordprocessingm";
case ".xls":
return "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
case ".xlsx":
return "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
case ".zip":
return "application/octet-stream";
case ".rar":
return "application/octet-stream";
default:
return "";
}
}
Future<void> sendChatToServer(
{required int chatEventId, required fileTypeId, required int targetUserId, required String targetUserName, required chatReplyId, required bool isAttachment, required bool isReply}) async {
Uuid uuid = const Uuid();
var msg = message.text;
SingleUserChatModel data = SingleUserChatModel(
chatEventId: chatEventId,
chatSource: 1,
contant: msg,
contantNo: uuid.v4(),
conversationId: uuid.v4(),
createdDate: DateTime.now(),
currentUserId: AppState().chatDetails!.response!.id,
currentUserName: AppState().chatDetails!.response!.userName,
targetUserId: targetUserId,
targetUserName: targetUserName,
isReplied: false,
fileTypeId: fileTypeId,
userChatReplyResponse: isReply ? UserChatReplyResponse.fromJson(repliedMsg.first.toJson()) : null,
fileTypeResponse: isAttachment
? FileTypeResponse(
fileTypeId: fileTypeId,
fileTypeName: getFileType(getFileExtension(selectedFile.path).toString()),
fileKind: getFileExtension(selectedFile.path),
fileName: selectedFile.path.split("/").last,
fileTypeDescription: getFileTypeDescription(getFileExtension(selectedFile.path).toString()),
)
: null,
);
userChatHistory.insert(0, data);
isFileSelected = false;
isMsgReply = false;
sFileType = "";
message.clear();
notifyListeners();
var contain = searchedChats!.where((ChatUser element) => element.id == targetUserId);
String chatData =
'{"contant":"$msg","contantNo":"${uuid.v4()}","chatEventId":$chatEventId,"fileTypeId": $fileTypeId,"currentUserId":${AppState().chatDetails!.response!.id},"chatSource":1,"userChatHistoryLineRequestList":[{"isSeen":false,"isDelivered":false,"targetUserId":$targetUserId,"targetUserStatus":1}],"chatReplyId":$chatReplyId,"conversationId":"${uuid.v4()}"}';
await hubConnection.invoke("AddChatUserAsync", args: <Object>[json.decode(chatData)]);
}
void sendChatMessage(int targetUserId, String targetUserName, BuildContext context) async {
dynamic contain = searchedChats!.where((ChatUser element) => element.id == targetUserId);
if (contain.isEmpty) {
searchedChats!.add(
ChatUser(
@ -254,51 +474,219 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
userName: targetUserName,
),
);
notifyListeners();
}
String chatData =
'{"contant":"$chatMessage","contantNo":"8a129295-36d7-7185-5d34-cc4eec7bcba4","chatEventId":1,"fileTypeId":null,"currentUserId":${AppState().chatDetails!.response!.id},"chatSource":1,"userChatHistoryLineRequestList":[{"isSeen":false,"isDelivered":false,"targetUserId":$targetUserId,"targetUserStatus":1}],"conversationId":"715f8b13-96ee-cd36-cb07-5a982a219982"}';
await hubConnection.invoke("AddChatUserAsync", args: <Object>[json.decode(chatData)]);
userChatHistory.add(
SingleUserChatModel(
chatEventId: 1,
chatSource: 1,
contant: chatMessage,
contantNo: "8a129295-36d7-7185-5d34-cc4eec7bcba4",
conversationId: "715f8b13-96ee-cd36-cb07-5a982a219982",
createdDate: DateTime.now(),
currentUserId: AppState().chatDetails!.response!.id,
currentUserName: AppState().chatDetails!.response!.userName,
if (!isFileSelected && !isMsgReply) {
logger.d("Normal Text Message");
if (message.text == null || message.text.isEmpty) {
return;
}
sendChatToServer(chatEventId: 1, fileTypeId: null, targetUserId: targetUserId, targetUserName: targetUserName, isAttachment: false, chatReplyId: null, isReply: false);
}
if (isFileSelected && !isMsgReply) {
Utils.showLoading(context);
logger.d("Normal Attachment Message");
dynamic value = await uploadAttachments(AppState().chatDetails!.response!.id.toString(), selectedFile);
String? ext = getFileExtension(selectedFile.path);
Utils.hideLoading(context);
sendChatToServer(chatEventId: 2, fileTypeId: getFileType(ext.toString()), targetUserId: targetUserId, targetUserName: targetUserName, isAttachment: true, chatReplyId: null, isReply: false);
}
if (!isFileSelected && isMsgReply) {
logger.d("Normal Text Message With Reply");
if (message.text == null || message.text.isEmpty) {
return;
}
sendChatToServer(
chatEventId: 1, fileTypeId: null, targetUserId: targetUserId, targetUserName: targetUserName, chatReplyId: repliedMsg.first.userChatHistoryId, isAttachment: false, isReply: true);
}
if (isFileSelected && isMsgReply) {
logger.d("Attachment Message With Reply");
Utils.showLoading(context);
dynamic value = await uploadAttachments(AppState().chatDetails!.response!.id.toString(), selectedFile);
String? ext = getFileExtension(selectedFile.path);
Utils.hideLoading(context);
sendChatToServer(
chatEventId: 2,
fileTypeId: getFileType(ext.toString()),
targetUserId: targetUserId,
targetUserName: targetUserName,
),
);
message.clear();
isAttachment: true,
chatReplyId: repliedMsg.first.userChatHistoryId,
isReply: true,
);
}
}
void selectImageToUpload(BuildContext context) {
ImageOptions.showImageOptionsNew(context, true, (String image, File file) async {
if (checkFileSize(file.path)) {
selectedFile = file;
isFileSelected = true;
sFileType = getFileExtension(file.path)!;
message.text = file.path.split("/").last;
Navigator.of(context).pop();
} else {
Utils.showToast("Max 1 mb size is allowed to upload");
}
notifyListeners();
});
}
void removeAttachment() {
isFileSelected = false;
sFileType = "";
message.text = '';
notifyListeners();
scrollDown();
}
void scrollDown() {
String? getFileExtension(String fileName) {
try {
return "." + fileName.split('.').last;
} catch (e) {
return null;
}
}
bool checkFileSize(String path) {
int fileSizeLimit = 1024;
File f = File(path);
double fileSizeInKB = f.lengthSync() / 1024;
double fileSizeInMB = fileSizeInKB / 1024;
if (fileSizeInKB > fileSizeLimit) {
return false;
} else {
return true;
}
}
String getType(String type) {
switch (type) {
case ".pdf":
return "assets/images/pdf.svg";
case ".png":
return "assets/images/png.svg";
case ".txt":
return "assets/icons/chat/txt.svg";
case ".jpg":
return "assets/images/jpg.svg";
case ".jpeg":
return "assets/images/jpg.svg";
case ".xls":
return "assets/icons/chat/xls.svg";
case ".xlsx":
return "assets/icons/chat/xls.svg";
case ".doc":
return "assets/icons/chat/doc.svg";
case ".docx":
return "assets/icons/chat/doc.svg";
case ".ppt":
return "assets/icons/chat/ppt.svg";
case ".pptx":
return "assets/icons/chat/ppt.svg";
case ".zip":
return "assets/icons/chat/zip.svg";
case ".rar":
return "assets/icons/chat/zip.svg";
default:
return "assets/images/thumb.svg";
}
}
void chatReply(SingleUserChatModel data) {
repliedMsg = [];
data.isReplied = true;
isMsgReply = true;
repliedMsg.add(data);
notifyListeners();
}
void closeMe() {
repliedMsg = [];
isMsgReply = false;
notifyListeners();
}
String dateFormte(DateTime data) {
DateFormat f = DateFormat('hh:mm a dd MMM yyyy');
f.format(data);
return f.format(data);
}
Future<void> favoriteUser({required int userID, required int targetUserID}) async {
Response response =
await ApiClient().postJsonForResponse("${ApiConsts.chatServerBaseApiUrl}FavUser/addFavUser", {"targetUserId": targetUserID, "userId": userID}, token: AppState().chatDetails!.response!.token);
fav.FavoriteChatUser favoriteChatUser = fav.FavoriteChatUser.fromRawJson(response.body);
if (favoriteChatUser.response != null) {
for (ChatUser user in searchedChats!) {
if (user.id == favoriteChatUser.response!.targetUserId!) {
user.isFav = favoriteChatUser.response!.isFav;
favUsersList.add(user);
}
}
}
notifyListeners();
}
Future<void> unFavoriteUser({required int userID, required int targetUserID}) async {
Response response = await ApiClient()
.postJsonForResponse("${ApiConsts.chatServerBaseApiUrl}FavUser/deleteFavUser", {"targetUserId": targetUserID, "userId": userID}, token: AppState().chatDetails!.response!.token);
fav.FavoriteChatUser favoriteChatUser = fav.FavoriteChatUser.fromRawJson(response.body);
if (favoriteChatUser.response != null) {
for (var user in searchedChats!) {
if (user.id == favoriteChatUser.response!.targetUserId!) {
user.isFav = favoriteChatUser.response!.isFav;
}
}
favUsersList.removeWhere((ChatUser element) => element.id == targetUserID);
}
notifyListeners();
}
void clearSelections() {
searchedChats = pChatHistory;
search.clear();
isChatScreenActive = false;
paginationVal = 0;
message.text = '';
isFileSelected = false;
repliedMsg = [];
sFileType = "";
notifyListeners();
}
void clearAll() {
searchedChats = pChatHistory;
search.clear();
isChatScreenActive = false;
paginationVal = 0;
message.text = '';
isFileSelected = false;
repliedMsg = [];
sFileType = "";
}
void scrollListener() {
_firstAutoscrollExecuted = true;
if (scrollController.hasClients && scrollController.position.pixels == scrollController.position.maxScrollExtent) {
_shouldAutoscroll = true;
} else {
_shouldAutoscroll = false;
}
}
void scrollToBottom() {
scrollController.animateTo(
scrollController.position.maxScrollExtent + 100,
curve: Curves.easeOut,
duration: const Duration(milliseconds: 300),
duration: const Duration(milliseconds: 500),
curve: Curves.easeIn,
);
notifyListeners();
}
// void _scrollListener() {
// if (scrollController.position.extentAfter.toInt() <= 0 && canCallApi) {
// if (userChatHistory.length < _ayatTangheemTypeMapped.totalItemsCount) {
// currentPageNo++;
// if (widget.tangheemQuery == null) {
// getTangheemData();
// } else {
// getTangheemDataByKeyword();
// }
// }
// canCallApi = false;
// }
// }
void msgScroll() {
scrollController.animateTo(
scrollController.position.minScrollExtent - 100,
duration: const Duration(milliseconds: 500),
curve: Curves.easeIn,
);
}
}

@ -1,10 +1,12 @@
import 'dart:async';
import 'dart:convert';
import 'package:http/http.dart';
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/models/chat/chat_count_conversation_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/itg_forms_model.dart';
@ -15,7 +17,6 @@ import 'package:mohem_flutter_app/models/itg/itg_response_model.dart';
import 'package:uuid/uuid.dart';
class DashboardApiClient {
static final DashboardApiClient _instance = DashboardApiClient._internal();
@ -178,4 +179,11 @@ class DashboardApiClient {
return responseData;
}, url, postParams);
}
Future<ChatUnreadCovnCountModel> getChatCount() async {
Response response = await ApiClient().getJsonForResponse(
"${ApiConsts.chatServerBaseApiUrl}user/unreadconversationcount/${AppState().getUserName}",
);
return chatUnreadCovnCountModelFromJson(response.body);
}
}

@ -18,47 +18,59 @@ class MyAttendanceApiClient {
factory MyAttendanceApiClient() => _instance;
Future<List<GetEITTransactionList>?> getEitTransaction(String pFunctionName) async {
Future<List<GetEITTransactionList>?> getEitTransaction(String pFunctionName, String? empID) async {
String url = "${ApiConsts.erpRest}GET_EIT_TRANSACTIONS";
Map<String, dynamic> postParams = {"P_PAGE_LIMIT": 50, "P_PAGE_NUM": 1, "P_SELECTED_RESP_ID": -999, "P_MENU_TYPE": "E", "P_FUNCTION_NAME": pFunctionName};
postParams.addAll(AppState().postParamsJson);
// postParams['P_SELECTED_EMPLOYEE_NUMBER'] = empID;
if('P_SELECTED_EMPLOYEE_NUMBER'.isNotEmpty){
postParams['P_SELECTED_EMPLOYEE_NUMBER'] = empID;
// AppState().postParamsJson['P_SELECTED_EMPLOYEE_NUMBER'] = empID;
print(empID);
}
return await ApiClient().postJsonForObject((json) {
GenericResponseModel? responseData = GenericResponseModel.fromJson(json);
return responseData.getEITTransactionList ?? [];
}, url, postParams);
}
Future<GenericResponseModel> getEitDffStructure(String pFunctionName) async {
Future<GenericResponseModel> getEitDffStructure(String pFunctionName, String? empID) async {
String url = "${ApiConsts.erpRest}GET_EIT_DFF_STRUCTURE";
Map<String, dynamic> postParams = {"P_SELECTED_RESP_ID": -999, "P_MENU_TYPE": "E", "P_FUNCTION_NAME": pFunctionName};
postParams.addAll(AppState().postParamsJson);
if('P_SELECTED_EMPLOYEE_NUMBER'.isNotEmpty) {
postParams['P_SELECTED_EMPLOYEE_NUMBER'] = empID;
}
return await ApiClient().postJsonForObject((json) {
GenericResponseModel? responseData = GenericResponseModel.fromJson(json);
return responseData;
}, url, postParams);
}
Future<List<ESERVICESVS>> getValueSetValues(String pSegmentName, String pDescFlexContextCode, String pDescFlexName, List<Map<String, dynamic>> list) async {
Future<List<ESERVICESVS>> getValueSetValues(String pSegmentName, String pDescFlexContextCode, String pDescFlexName, List<Map<String, dynamic>> list,{ String? empID, String? parentValue}) async {
String url = "${ApiConsts.erpRest}GET_VALUE_SET_VALUES";
Map<String, dynamic> postParams = {
"P_SELECTED_RESP_ID": -999,
"P_MENU_TYPE": "E",
"P_PAGE_LIMIT": 1000,
"P_PAGE_NUM": 1,
"P_PARENT_VALUE": null,
"P_PARENT_VALUE": empID!.isNotEmpty? parentValue : null,
"P_SEGMENT_NAME": pSegmentName,
"P_DESC_FLEX_CONTEXT_CODE": pDescFlexContextCode,
"P_DESC_FLEX_NAME": pDescFlexName,
"GetValueSetValuesTBL": list,
};
postParams.addAll(AppState().postParamsJson);
if('P_SELECTED_EMPLOYEE_NUMBER'.isNotEmpty) {
postParams['P_SELECTED_EMPLOYEE_NUMBER'] = empID;
}
return await ApiClient().postJsonForObject((json) {
GenericResponseModel? responseData = GenericResponseModel.fromJson(json);
return responseData.getValueSetValuesList ?? [];
}, url, postParams);
}
Future<ESERVICESDV> getDefaultValue(String pSegmentName, String pDescFlexContextCode, String pDescFlexName, List<Map<String, dynamic>> list) async {
Future<ESERVICESDV> getDefaultValue(String pSegmentName, String pDescFlexContextCode, String pDescFlexName, List<Map<String, dynamic>> list, String? empID) async {
String url = "${ApiConsts.erpRest}GET_DEFAULT_VALUE";
Map<String, dynamic> postParams = {
"P_SELECTED_RESP_ID": -999,
@ -70,13 +82,16 @@ class MyAttendanceApiClient {
"GetValueSetValuesTBL": list,
};
postParams.addAll(AppState().postParamsJson);
if('P_SELECTED_EMPLOYEE_NUMBER'.isNotEmpty) {
postParams['P_SELECTED_EMPLOYEE_NUMBER'] = empID;
}
return await ApiClient().postJsonForObject((json) {
GenericResponseModel? responseData = GenericResponseModel.fromJson(json);
return ESERVICESDV.fromJson(responseData.getDefaultValueList!.toJson());
}, url, postParams);
}
Future<GenericResponseModel?> validateEitTransaction(String pDescFlexContextCode, String pFunctionName, List<Map<String, dynamic>> list) async {
Future<GenericResponseModel?> validateEitTransaction(String pDescFlexContextCode, String pFunctionName, List<Map<String, dynamic>> list, { String? empID}) async {
String url = "${ApiConsts.erpRest}VALIDATE_EIT_TRANSACTION";
Map<String, dynamic> postParams = {
"P_SELECTED_RESP_ID": -999,
@ -86,6 +101,9 @@ class MyAttendanceApiClient {
"EITTransactionTBL": list,
};
postParams.addAll(AppState().postParamsJson);
if('P_SELECTED_EMPLOYEE_NUMBER'.isNotEmpty) {
postParams['P_SELECTED_EMPLOYEE_NUMBER'] = empID;
}
return await ApiClient().postJsonForObject((json) {
GenericResponseModel? responseData = GenericResponseModel.fromJson(json);
return responseData; //ESERVICESDV.fromJson(responseData.getDefaultValueList!.toJson());

@ -403,6 +403,24 @@ class WorkListApiClient {
}, url, postParams);
}
Future<ITGRequest?> grantITGRequest(String requestType, int taskId, int itemId, String employeeNumber, String newUserEMPId, String comments) async {
String url = "${ApiConsts.cocRest}ITGGrantAccess";
Map<String, dynamic> postParams = {
"RequestType": requestType,
"TaskID": taskId,
"ItemID": itemId,
"EmployeeNumber": employeeNumber,
"Comments": "",
"AdditionalFields": null,
"NewUserEMPId":newUserEMPId
};
postParams.addAll(AppState().postParamsJson);
return await ApiClient().postJsonForObject((json) {
ItgFormsModel responseData = ItgFormsModel.fromJson(json);
return responseData.itgRequest;
}, url, postParams);
}
Future<ITGRequest?> informationITGRequest(String requestType, int taskId, int itemId, String employeeNumber, String newUserEMPId, String comments) async {
String url = "${ApiConsts.cocRest}ITGRequestInformation";
Map<String, dynamic> postParams = {

@ -120,6 +120,12 @@ class AppState {
set setItgWorkListIndex(int? _itgWorkListIndex) => itgWorkListIndex = _itgWorkListIndex;
String? itgRequestType;
set setItgRequestType(String? _itgRequestType) => itgRequestType = _itgRequestType;
String? get getItgRequestType => itgRequestType;
UserAutoLoginModel? chatDetails;
set setchatUserDetails(UserAutoLoginModel details) => chatDetails = details;

@ -60,4 +60,5 @@ class MyColors {
static const Color grey35Color = Color(0xff535353);
static const Color grey9DColor = Color(0xff9D9D9D);
static const Color darkDigitColor = Color(0xff2D2F39);
static const Color grey71Color = Color(0xff717171);
}

@ -1,7 +1,7 @@
class ApiConsts {
//static String baseUrl = "http://10.200.204.20:2801/"; // Local server
// static String baseUrl = "https://uat.hmgwebservices.com"; // UAT server
static String baseUrl = "https://hmgwebservices.com"; // Live server
static String baseUrl = "https://uat.hmgwebservices.com"; // UAT server
//static String baseUrl = "https://hmgwebservices.com"; // Live server
static String baseUrlServices = baseUrl + "/Services/"; // server
// static String baseUrlServices = "https://api.cssynapses.com/tangheem/"; // Live server
static String utilitiesRest = baseUrlServices + "Utilities.svc/REST/";
@ -10,15 +10,15 @@ class ApiConsts {
static String user = baseUrlServices + "api/User/";
static String cocRest = baseUrlServices + "COCWS.svc/REST/";
//Chat
static String chatServerBaseUrl = "https://apiderichat.hmg.com";
static String chatServerBaseApiUrl = "https://apiderichat.hmg.com/api/";
static String chatHubConnectionUrl = chatServerBaseUrl + "/ConnectionChatHub";
static String chatSearchMember = "user/getUserWithStatusAndFavAsync/";
static String chatRecentUrl = "UserChatHistory/getchathistorybyuserid"; //For a Mem
static String chatSingleUserHistoryUrl = "UserChatHistory/GetUserChatHistory";
// 42062 is CurrentUserID and 36745 is targetUserID and 0 is For Pagination
// static String chatSearchMember = "https://apiderichat.hmg.com/api/user/getUserWithStatusAndFavAsync/aamir.muhammad/36239";
static String chatMediaImageUploadUrl = "shared/upload";
static String chatFavoriteUsers = "FavUser/getFavUserById/";
}
class SharedPrefsConsts {

@ -381,6 +381,30 @@ class DateUtil {
return "";
}
static String formatDuration(Duration d) {
var seconds = d.inSeconds;
var days = seconds ~/ Duration.secondsPerDay;
seconds -= days * Duration.secondsPerDay;
var hours = seconds ~/ Duration.secondsPerHour;
seconds -= hours * Duration.secondsPerHour;
var minutes = seconds ~/ Duration.secondsPerMinute;
seconds -= minutes * Duration.secondsPerMinute;
List<String> tokens = [];
if (days != 0) {
tokens.add('$days days');
}
if (tokens.isNotEmpty || hours != 0) {
tokens.add('$hours hours');
}
if (tokens.isNotEmpty || minutes != 0) {
tokens.add('$minutes mins');
}
tokens.add('$seconds secs');
return tokens.join(' ');
}
/// get data formatted like 26/4/2020
/// [dateTime] convert DateTime to data formatted according to language
static String getDayMonthYearDateFormattedLang(DateTime dateTime, bool isArabic) {
@ -431,30 +455,30 @@ class DateUtil {
return "/Date(" + DateFormat('mm-dd-yyy').parse(isoDate).millisecondsSinceEpoch.toString() + ")/";
}
// static String getDay(DayOfWeek dayOfWeek) {
// switch (dayOfWeek) {
// case DayOfWeek.Monday:
// return "Monday";
// break;
// case DayOfWeek.Tuesday:
// return "Tuesday";
// break;
// case DayOfWeek.Wednesday:
// return "Wednesday";
// break;
// case DayOfWeek.Thursday:
// return "Thursday";
// break;
// case DayOfWeek.Friday:
// return "Friday";
// break;
// case DayOfWeek.Saturday:
// return "Saturday";
// break;
// case DayOfWeek.Sunday:
// return "Sunday";
// break;
// }
// return "";
// }
// static String getDay(DayOfWeek dayOfWeek) {
// switch (dayOfWeek) {
// case DayOfWeek.Monday:
// return "Monday";
// break;
// case DayOfWeek.Tuesday:
// return "Tuesday";
// break;
// case DayOfWeek.Wednesday:
// return "Wednesday";
// break;
// case DayOfWeek.Thursday:
// return "Thursday";
// break;
// case DayOfWeek.Friday:
// return "Friday";
// break;
// case DayOfWeek.Saturday:
// return "Saturday";
// break;
// case DayOfWeek.Sunday:
// return "Sunday";
// break;
// }
// return "";
// }
}

@ -5,6 +5,7 @@ import 'package:mohem_flutter_app/ui/attendance/vacation_rule_screen.dart';
import 'package:mohem_flutter_app/ui/bottom_sheets/attendence_details_bottom_sheet.dart';
import 'package:mohem_flutter_app/ui/chat/chat_detailed_screen.dart';
import 'package:mohem_flutter_app/ui/chat/chat_home.dart';
import 'package:mohem_flutter_app/ui/chat/favorite_users_screen.dart';
import 'package:mohem_flutter_app/ui/landing/dashboard_screen.dart';
import 'package:mohem_flutter_app/ui/landing/itg/survey_screen.dart';
import 'package:mohem_flutter_app/ui/landing/today_attendance_screen.dart';
@ -177,6 +178,7 @@ class AppRoutes {
//Chat
static const String chat = "/chat";
static const String chatDetailed = "/chatDetailed";
static const String chatFavoriteUsers = "/chatFavoriteUsers";
//Marathon
static const String marathonIntroScreen = "/marathonIntroScreen";
@ -287,8 +289,9 @@ class AppRoutes {
changePassword: (BuildContext context) => ChangePasswordScreen(),
//Chat
chat: (BuildContext context) => ChatHomeScreen(),
chat: (BuildContext context) => ChatHome(),
chatDetailed: (BuildContext context) => ChatDetailScreen(),
chatFavoriteUsers: (BuildContext context) => ChatFavoriteUsersScreen(),
// Marathon
marathonIntroScreen: (BuildContext context) => MarathonIntroScreen(),

@ -11,10 +11,12 @@ import 'package:mohem_flutter_app/widgets/button/default_button.dart';
import 'package:mohem_flutter_app/widgets/otp_widget.dart';
import 'package:sizer/sizer.dart';
final ValueNotifier<String> otpFieldClear = ValueNotifier<String>("");
class OtpDialog {
final int type;
final int? mobileNo;
final Function(String) onSuccess;
final Function(String, TextEditingController _pinPutController) onSuccess;
final Function onFailure;
final BuildContext context;
final Function onResendCode;
@ -96,58 +98,70 @@ class OtpDialog {
6.height,
(LocaleKeys.pleaseEnterTheVerificationCodeSentTo.tr() + ' xxxxxxxx' + mobileNo.toString().substring(mobileNo.toString().length - 3)).toText16(),
18.height,
Directionality(
textDirection: TextDirection.ltr,
child: Center(
child: OTPWidget(
autoFocus: true,
controller: _pinPutController,
defaultBorderColor: const Color(0xffD8D8D8),
maxLength: 4,
onTextChanged: (text) {},
pinBoxColor: Colors.white,
onDone: (code) => _onOtpCallBack(code, null),
textBorderColor: const Color(0xffD8D8D8),
pinBoxWidth: 60,
pinBoxHeight: 60,
pinTextStyle: const TextStyle(fontSize: 24.0, color: MyColors.darkTextColor),
pinTextAnimatedSwitcherTransition: ProvidedPinBoxTextAnimation.scalingTransition,
pinTextAnimatedSwitcherDuration: const Duration(milliseconds: 300),
pinBoxRadius: 10,
keyboardType: TextInputType.number,
),
),
),
10.height,
stopTimer
? Row(
children: [
Expanded(
child: LocaleKeys.codeExpire.tr().toText16(
color: MyColors.redColor,
),
),
12.width,
Image.asset(
"assets/icons/ic_alarm.png",
width: 20,
height: 20,
color: MyColors.redColor,
),
],
)
: RichText(
text: TextSpan(
text: LocaleKeys.theVerificationCodeWillExpireIn.tr() + '\n',
style: const TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: MyColors.darkTextColor, letterSpacing: -0.48),
children: <TextSpan>[
TextSpan(
text: displayTime,
style: const TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: MyColors.textMixColor, letterSpacing: -0.48),
ValueListenableBuilder<String>(
builder: (BuildContext context, String value, Widget? child) {
// This builder will only get called when the _counter
// is updated.
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Directionality(
textDirection: TextDirection.ltr,
child: Center(
child: OTPWidget(
autoFocus: true,
controller: _pinPutController,
defaultBorderColor: const Color(0xffD8D8D8),
maxLength: 4,
onTextChanged: (text) {},
pinBoxColor: Colors.white,
onDone: (code) => _onOtpCallBack(code, null),
textBorderColor: const Color(0xffD8D8D8),
pinBoxWidth: 60,
pinBoxHeight: 60,
pinTextStyle: const TextStyle(fontSize: 24.0, color: MyColors.darkTextColor),
pinTextAnimatedSwitcherTransition: ProvidedPinBoxTextAnimation.scalingTransition,
pinTextAnimatedSwitcherDuration: const Duration(milliseconds: 300),
pinBoxRadius: 10,
keyboardType: TextInputType.number,
),
],
),
),
),
10.height,
stopTimer
? Row(
children: [
Expanded(
child: LocaleKeys.codeExpire.tr().toText16(
color: MyColors.redColor,
),
),
12.width,
Image.asset(
"assets/icons/ic_alarm.png",
width: 20,
height: 20,
color: MyColors.redColor,
),
],
)
: RichText(
text: TextSpan(
text: LocaleKeys.theVerificationCodeWillExpireIn.tr() + '\n',
style: const TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: MyColors.darkTextColor, letterSpacing: -0.48),
children: <TextSpan>[
TextSpan(
text: displayTime,
style: const TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: MyColors.textMixColor, letterSpacing: -0.48),
),
],
),
),
],
);
},
valueListenable: otpFieldClear,
),
18.height,
DefaultButton(
stopTimer ? LocaleKeys.resend.tr() : LocaleKeys.cancel.tr(),
@ -238,14 +252,15 @@ class OtpDialog {
});
}
static void hideSMSBox(context) {
Navigator.pop(context);
void hideSMSBox(context) {
onFailure();
}
void _onOtpCallBack(String otpCode, bool? isAutofill) {
if (otpCode.length == 4) {
stopTimer = true;
onSuccess(otpCode);
// stopTimer = true;
otpFieldClear.value = otpCode;
onSuccess(otpCode, _pinPutController);
}
}

@ -18,12 +18,13 @@ extension EmailValidator on String {
Widget toText10({Color? color, bool isBold = false, int? maxlines, FontStyle? fontStyle}) => Text(
this,
//maxLines: maxlines,
maxLines: maxlines,
style: TextStyle(fontSize: 10, fontStyle: fontStyle ?? FontStyle.normal, fontWeight: isBold ? FontWeight.bold : FontWeight.w600, color: color ?? MyColors.darkTextColor, letterSpacing: -0.4),
);
Widget toText11({Color? color, FontWeight? weight, bool isUnderLine = false, bool isBold = false}) => Text(
Widget toText11({Color? color, FontWeight? weight, bool isUnderLine = false, bool isBold = false, int maxLine = 0}) => Text(
this,
maxLines: (maxLine > 0) ? maxLine : null,
style: TextStyle(
fontSize: 11,
fontWeight: weight ?? (isBold ? FontWeight.bold : FontWeight.w600),

@ -514,7 +514,9 @@ class CodegenLoader extends AssetLoader{
"verification": "تَحَقّق",
"resend": "إعادة إرسال",
"codeExpire": "انتهت صلاحية رمز التحقق",
"typeheretoreply": "اكتب هنا للرد"
"typeheretoreply": "اكتب هنا للرد",
"favorite": "مفضلتي",
"searchfromchat": "البحث من الدردشة"
};
static const Map<String,dynamic> en_US = {
"mohemm": "Mohemm",
@ -1016,7 +1018,9 @@ static const Map<String,dynamic> en_US = {
"resend": "Resend",
"codeExpire": "The verification code has been expired",
"allQuestionsCorrect": "You have answered all questions correct",
"typeheretoreply": "Type here to reply"
"typeheretoreply": "Type here to reply",
"favorite": "My Favorites",
"searchfromchat": "Search from chat"
};
static const Map<String, Map<String,dynamic>> mapLocales = {"ar_SA": ar_SA, "en_US": en_US};
}

@ -485,5 +485,7 @@ abstract class LocaleKeys {
static const resend = 'resend';
static const codeExpire = 'codeExpire';
static const typeheretoreply = 'typeheretoreply';
static const favorite = 'favorite';
static const searchfromchat = 'searchfromchat';
}

@ -0,0 +1,37 @@
//
// Generated file. Do not edit.
//
// ignore_for_file: directives_ordering
// ignore_for_file: lines_longer_than_80_chars
// ignore_for_file: depend_on_referenced_packages
import 'package:file_picker/_internal/file_picker_web.dart';
import 'package:firebase_core_web/firebase_core_web.dart';
import 'package:firebase_messaging_web/firebase_messaging_web.dart';
import 'package:fluttertoast/fluttertoast_web.dart';
import 'package:geolocator_web/geolocator_web.dart';
import 'package:google_maps_flutter_web/google_maps_flutter_web.dart';
import 'package:image_picker_for_web/image_picker_for_web.dart';
import 'package:shared_preferences_web/shared_preferences_web.dart';
import 'package:url_launcher_web/url_launcher_web.dart';
import 'package:video_player_web/video_player_web.dart';
import 'package:wakelock_web/wakelock_web.dart';
import 'package:flutter_web_plugins/flutter_web_plugins.dart';
// ignore: public_member_api_docs
void registerPlugins(Registrar registrar) {
FilePickerWeb.registerWith(registrar);
FirebaseCoreWeb.registerWith(registrar);
FirebaseMessagingWeb.registerWith(registrar);
FluttertoastWebPlugin.registerWith(registrar);
GeolocatorPlugin.registerWith(registrar);
GoogleMapsPlugin.registerWith(registrar);
ImagePickerPlugin.registerWith(registrar);
SharedPreferencesPlugin.registerWith(registrar);
UrlLauncherPlugin.registerWith(registrar);
VideoPlayerPlugin.registerWith(registrar);
WakelockWeb.registerWith(registrar);
registrar.registerMessageHandler();
}

@ -92,6 +92,12 @@ class MyApp extends StatelessWidget {
MonthYearPickerLocalizations.delegate,
);
return MaterialApp(
builder: (BuildContext context, Widget? child) {
return MediaQuery(
data: MediaQuery.of(context).copyWith(textScaleFactor: 1.0),
child: child!,
);
},
theme: AppTheme.getTheme(
EasyLocalization.of(context)?.locale.languageCode == "ar",
),

@ -0,0 +1,117 @@
class IncomingCallData {
String? callerID;
String? receiverID;
String? msgID;
String? notfID;
String? notificationForeground;
String? count;
String? message;
String? appointmentNo;
String? title;
String? projectID;
String? notificationType;
String? background;
String? doctorname;
String? clinicname;
String? speciality;
String? appointmentdate;
String? appointmenttime;
String? type;
String? sessionId;
String? identity;
String? name;
String? videoUrl;
String? picture;
String? token;
String? isCall;
String? sound;
String? server;
String? isWebRTC;
IncomingCallData(
{this.msgID,
this.notfID,
this.notificationForeground,
this.count,
this.message,
this.appointmentNo,
this.title,
this.projectID,
this.notificationType,
this.background,
this.doctorname,
this.clinicname,
this.speciality,
this.appointmentdate,
this.appointmenttime,
this.type,
this.sessionId,
this.identity,
this.name,
this.videoUrl,
this.picture,
this.isCall,
this.sound});
IncomingCallData.fromJson(Map<String, dynamic> json) {
callerID = json['callerID'];
receiverID = json['PatientID'];
msgID = json['msgID'];
notfID = json['notfID'];
notificationForeground = json['notification_foreground'];
count = json['count'];
message = json['message'];
appointmentNo = json['AppointmentNo'];
title = json['title'];
projectID = json['ProjectID'];
notificationType = json['NotificationType'];
background = json['background'];
doctorname = json['doctorname'];
clinicname = json['clinicname'];
speciality = json['speciality'];
appointmentdate = json['appointmentdate'];
appointmenttime = json['appointmenttime'];
type = json['type'];
sessionId = json['session_id'];
token = json['token'];
identity = json['identity'];
name = json['name'];
videoUrl = json['videoUrl'];
picture = json['picture'];
isCall = json['is_call'];
sound = json['sound'];
server = json['server'];
isWebRTC = json['is_webrtc'] ?? "true";
}
Map<String, dynamic> toJson() {
Map<String, dynamic> data = Map<String, dynamic>();
data['msgID'] = this.msgID;
data['notfID'] = this.notfID;
data['notification_foreground'] = this.notificationForeground;
data['count'] = this.count;
data['message'] = this.message;
data['AppointmentNo'] = this.appointmentNo;
data['title'] = this.title;
data['ProjectID'] = this.projectID;
data['NotificationType'] = this.notificationType;
data['background'] = this.background;
data['doctorname'] = this.doctorname;
data['clinicname'] = this.clinicname;
data['speciality'] = this.speciality;
data['appointmentdate'] = this.appointmentdate;
data['appointmenttime'] = this.appointmenttime;
data['type'] = this.type;
data['session_id'] = this.sessionId;
data['token'] = this.token;
data['identity'] = this.identity;
data['name'] = this.name;
data['videoUrl'] = this.videoUrl;
data['picture'] = this.picture;
data['is_call'] = this.isCall;
data['sound'] = this.sound;
data['server'] = this.server;
data['is_webrtc'] = this.isWebRTC;
return data;
}
}

@ -0,0 +1,25 @@
import 'dart:convert';
ChatUnreadCovnCountModel chatUnreadCovnCountModelFromJson(String str) => ChatUnreadCovnCountModel.fromJson(json.decode(str));
String chatUnreadCovnCountModelToJson(ChatUnreadCovnCountModel data) => json.encode(data.toJson());
class ChatUnreadCovnCountModel {
ChatUnreadCovnCountModel({
this.singleChatCount,
this.groupChatCount,
});
int? singleChatCount;
int? groupChatCount;
factory ChatUnreadCovnCountModel.fromJson(Map<String, dynamic> json) => ChatUnreadCovnCountModel(
singleChatCount: json["singleChatCount"] == null ? null : json["singleChatCount"],
groupChatCount: json["groupChatCount"] == null ? null : json["groupChatCount"],
);
Map<String, dynamic> toJson() => {
"singleChatCount": singleChatCount == null ? null : singleChatCount,
"groupChatCount": groupChatCount == null ? null : groupChatCount,
};
}

@ -1,3 +1,9 @@
import 'dart:convert';
List<SingleUserChatModel> singleUserChatModelFromJson(String str) => List<SingleUserChatModel>.from(json.decode(str).map((x) => SingleUserChatModel.fromJson(x)));
String singleUserChatModelToJson(List<SingleUserChatModel> data) => json.encode(List<dynamic>.from(data.map((x) => x.toJson())));
class SingleUserChatModel {
SingleUserChatModel({
this.userChatHistoryId,
@ -19,6 +25,7 @@ class SingleUserChatModel {
this.conversationId,
this.fileTypeResponse,
this.userChatReplyResponse,
this.isReplied,
});
int? userChatHistoryId;
@ -29,17 +36,18 @@ class SingleUserChatModel {
String? currentUserName;
int? targetUserId;
String? targetUserName;
dynamic encryptedTargetUserId;
dynamic encryptedTargetUserName;
String? encryptedTargetUserId;
String? encryptedTargetUserName;
int? chatEventId;
dynamic fileTypeId;
dynamic? fileTypeId;
bool? isSeen;
bool? isDelivered;
DateTime? createdDate;
int? chatSource;
String? conversationId;
FileTypeResponse? fileTypeResponse;
dynamic userChatReplyResponse;
UserChatReplyResponse? userChatReplyResponse;
bool? isReplied;
factory SingleUserChatModel.fromJson(Map<String, dynamic> json) => SingleUserChatModel(
userChatHistoryId: json["userChatHistoryId"] == null ? null : json["userChatHistoryId"],
@ -50,8 +58,8 @@ class SingleUserChatModel {
currentUserName: json["currentUserName"] == null ? null : json["currentUserName"],
targetUserId: json["targetUserId"] == null ? null : json["targetUserId"],
targetUserName: json["targetUserName"] == null ? null : json["targetUserName"],
encryptedTargetUserId: json["encryptedTargetUserId"],
encryptedTargetUserName: json["encryptedTargetUserName"],
encryptedTargetUserId: json["encryptedTargetUserId"] == null ? null : json["encryptedTargetUserId"],
encryptedTargetUserName: json["encryptedTargetUserName"] == null ? null : json["encryptedTargetUserName"],
chatEventId: json["chatEventId"] == null ? null : json["chatEventId"],
fileTypeId: json["fileTypeId"],
isSeen: json["isSeen"] == null ? null : json["isSeen"],
@ -60,7 +68,8 @@ class SingleUserChatModel {
chatSource: json["chatSource"] == null ? null : json["chatSource"],
conversationId: json["conversationId"] == null ? null : json["conversationId"],
fileTypeResponse: json["fileTypeResponse"] == null ? null : FileTypeResponse.fromJson(json["fileTypeResponse"]),
userChatReplyResponse: json["userChatReplyResponse"],
userChatReplyResponse: json["userChatReplyResponse"] == null ? null : UserChatReplyResponse.fromJson(json["userChatReplyResponse"]),
isReplied: false,
);
Map<String, dynamic> toJson() => {
@ -72,8 +81,8 @@ class SingleUserChatModel {
"currentUserName": currentUserName == null ? null : currentUserName,
"targetUserId": targetUserId == null ? null : targetUserId,
"targetUserName": targetUserName == null ? null : targetUserName,
"encryptedTargetUserId": encryptedTargetUserId,
"encryptedTargetUserName": encryptedTargetUserName,
"encryptedTargetUserId": encryptedTargetUserId == null ? null : encryptedTargetUserId,
"encryptedTargetUserName": encryptedTargetUserName == null ? null : encryptedTargetUserName,
"chatEventId": chatEventId == null ? null : chatEventId,
"fileTypeId": fileTypeId,
"isSeen": isSeen == null ? null : isSeen,
@ -82,7 +91,7 @@ class SingleUserChatModel {
"chatSource": chatSource == null ? null : chatSource,
"conversationId": conversationId == null ? null : conversationId,
"fileTypeResponse": fileTypeResponse == null ? null : fileTypeResponse!.toJson(),
"userChatReplyResponse": userChatReplyResponse,
"userChatReplyResponse": userChatReplyResponse == null ? null : userChatReplyResponse!.toJson(),
};
}
@ -117,3 +126,51 @@ class FileTypeResponse {
"fileName": fileName,
};
}
class UserChatReplyResponse {
UserChatReplyResponse({
this.userChatHistoryId,
this.chatEventId,
this.contant,
this.contantNo,
this.fileTypeId,
this.createdDate,
this.targetUserId,
this.targetUserName,
this.fileTypeResponse,
});
int? userChatHistoryId;
int? chatEventId;
String? contant;
String? contantNo;
dynamic? fileTypeId;
DateTime? createdDate;
int? targetUserId;
String? targetUserName;
FileTypeResponse? fileTypeResponse;
factory UserChatReplyResponse.fromJson(Map<String, dynamic> json) => UserChatReplyResponse(
userChatHistoryId: json["userChatHistoryId"] == null ? null : json["userChatHistoryId"],
chatEventId: json["chatEventId"] == null ? null : json["chatEventId"],
contant: json["contant"] == null ? null : json["contant"],
contantNo: json["contantNo"] == null ? null : json["contantNo"],
fileTypeId: json["fileTypeId"],
createdDate: json["createdDate"] == null ? null : DateTime.parse(json["createdDate"]),
targetUserId: json["targetUserId"] == null ? null : json["targetUserId"],
targetUserName: json["targetUserName"] == null ? null : json["targetUserName"],
fileTypeResponse: json["fileTypeResponse"] == null ? null : FileTypeResponse.fromJson(json["fileTypeResponse"]),
);
Map<String, dynamic> toJson() => {
"userChatHistoryId": userChatHistoryId == null ? null : userChatHistoryId,
"chatEventId": chatEventId == null ? null : chatEventId,
"contant": contant == null ? null : contant,
"contantNo": contantNo == null ? null : contantNo,
"fileTypeId": fileTypeId,
"createdDate": createdDate == null ? null : createdDate!.toIso8601String(),
"targetUserId": targetUserId == null ? null : targetUserId,
"targetUserName": targetUserName == null ? null : targetUserName,
"fileTypeResponse": fileTypeResponse == null ? null : fileTypeResponse!.toJson(),
};
}

@ -1,4 +1,3 @@
import 'dart:convert';
UserAutoLoginModel userAutoLoginModelFromJson(String str) => UserAutoLoginModel.fromJson(json.decode(str));
@ -7,22 +6,22 @@ String userAutoLoginModelToJson(UserAutoLoginModel data) => json.encode(data.toJ
class UserAutoLoginModel {
UserAutoLoginModel({
this.response,
this.response,
this.errorResponses,
});
Response? response;
dynamic? errorResponses;
List<ErrorResponse>? errorResponses;
factory UserAutoLoginModel.fromJson(Map<String, dynamic> json) => UserAutoLoginModel(
response: json["response"] == null ? null : Response.fromJson(json["response"]),
errorResponses: json["errorResponses"],
);
response: json["response"] == null ? null : Response.fromJson(json["response"]),
errorResponses: json["errorResponses"] == null ? null : List<ErrorResponse>.from(json["errorResponses"].map((x) => ErrorResponse.fromJson(x))),
);
Map<String, dynamic> toJson() => {
"response": response == null ? null : response!.toJson(),
"errorResponses": errorResponses,
};
"response": response == null ? null : response!.toJson(),
"errorResponses": errorResponses == null ? null : List<dynamic>.from(errorResponses!.map((x) => x.toJson())),
};
}
class Response {
@ -51,28 +50,48 @@ class Response {
String? encryptedUserName;
factory Response.fromJson(Map<String, dynamic> json) => Response(
id: json["id"] == null ? null : json["id"],
userName: json["userName"] == null ? null : json["userName"],
email: json["email"] == null ? null : json["email"],
phone: json["phone"] == null ? null : json["phone"],
title: json["title"] == null ? null : json["title"],
token: json["token"] == null ? null : json["token"],
isDomainUser: json["isDomainUser"] == null ? null : json["isDomainUser"],
isActiveCode: json["isActiveCode"] == null ? null : json["isActiveCode"],
encryptedUserId: json["encryptedUserId"] == null ? null : json["encryptedUserId"],
encryptedUserName: json["encryptedUserName"] == null ? null : json["encryptedUserName"],
);
id: json["id"] == null ? null : json["id"],
userName: json["userName"] == null ? null : json["userName"],
email: json["email"] == null ? null : json["email"],
phone: json["phone"] == null ? null : json["phone"],
title: json["title"] == null ? null : json["title"],
token: json["token"] == null ? null : json["token"],
isDomainUser: json["isDomainUser"] == null ? null : json["isDomainUser"],
isActiveCode: json["isActiveCode"] == null ? null : json["isActiveCode"],
encryptedUserId: json["encryptedUserId"] == null ? null : json["encryptedUserId"],
encryptedUserName: json["encryptedUserName"] == null ? null : json["encryptedUserName"],
);
Map<String, dynamic> toJson() => {
"id": id == null ? null : id,
"userName": userName == null ? null : userName,
"email": email == null ? null : email,
"phone": phone == null ? null : phone,
"title": title == null ? null : title,
"token": token == null ? null : token,
"isDomainUser": isDomainUser == null ? null : isDomainUser,
"isActiveCode": isActiveCode == null ? null : isActiveCode,
"encryptedUserId": encryptedUserId == null ? null : encryptedUserId,
"encryptedUserName": encryptedUserName == null ? null : encryptedUserName,
};
}
class ErrorResponse {
ErrorResponse({
this.fieldName,
this.message,
});
String? fieldName;
String? message;
factory ErrorResponse.fromJson(Map<String, dynamic> json) => ErrorResponse(
fieldName: json["fieldName"] == null ? null : json["fieldName"],
message: json["message"] == null ? null : json["message"],
);
Map<String, dynamic> toJson() => {
"id": id == null ? null : id,
"userName": userName == null ? null : userName,
"email": email == null ? null : email,
"phone": phone == null ? null : phone,
"title": title == null ? null : title,
"token": token == null ? null : token,
"isDomainUser": isDomainUser == null ? null : isDomainUser,
"isActiveCode": isActiveCode == null ? null : isActiveCode,
"encryptedUserId": encryptedUserId == null ? null : encryptedUserId,
"encryptedUserName": encryptedUserName == null ? null : encryptedUserName,
};
"fieldName": fieldName == null ? null : fieldName,
"message": message == null ? null : message,
};
}

@ -0,0 +1,53 @@
// To parse this JSON data, do
//
// final favoriteChatUser = favoriteChatUserFromJson(jsonString);
import 'dart:convert';
class FavoriteChatUser {
FavoriteChatUser({
this.response,
this.errorResponses,
});
Response? response;
dynamic? errorResponses;
factory FavoriteChatUser.fromRawJson(String str) => FavoriteChatUser.fromJson(json.decode(str));
String toRawJson() => json.encode(toJson());
factory FavoriteChatUser.fromJson(Map<String, dynamic> json) => FavoriteChatUser(
response: json["response"] == null ? null : Response.fromJson(json["response"]),
errorResponses: json["errorResponses"],
);
Map<String, dynamic> toJson() => {
"response": response == null ? null : response!.toJson(),
"errorResponses": errorResponses,
};
}
class Response {
Response({
this.targetUserId,
this.isFav,
});
int? targetUserId;
bool? isFav;
factory Response.fromRawJson(String str) => Response.fromJson(json.decode(str));
String toRawJson() => json.encode(toJson());
factory Response.fromJson(Map<String, dynamic> json) => Response(
targetUserId: json["targetUserId"] == null ? null : json["targetUserId"],
isFav: json["isFav"] == null ? null : json["isFav"],
);
Map<String, dynamic> toJson() => {
"targetUserId": targetUserId == null ? null : targetUserId,
"isFav": isFav == null ? null : isFav,
};
}

@ -334,7 +334,7 @@ class GenericResponseModel {
String? sFHGetPrNotificationBodyList;
StartAbsenceApprovalProccess? startAbsenceApprovalProccess;
StartAddressApprovalProcess? startAddressApprovalProcessList;
String? startBasicDetApprProcessList;
StartAddressApprovalProcess? startBasicDetApprProcessList;
String? startCeiApprovalProcess;
String? startContactApprovalProcessList;
StartEitApprovalProcess? startEitApprovalProcess;
@ -1283,7 +1283,7 @@ class GenericResponseModel {
if (json['RespondRolesList'] != null) {
respondRolesList = <String>[];
json['RespondRolesList'].forEach((v) {
respondRolesList!.add(v);
// respondRolesList!.add(v);
});
}
resubmitAbsenceTransactionList = json['ResubmitAbsenceTransactionList'];
@ -1294,7 +1294,7 @@ class GenericResponseModel {
startAbsenceApprovalProccess = json['StartAbsenceApprovalProccess'] != null ? StartAbsenceApprovalProccess.fromJson(json['StartAbsenceApprovalProccess']) : null;
startAddressApprovalProcessList = json['StartAddressApprovalProcessList'] != null ? StartAddressApprovalProcess.fromJson(json['StartAddressApprovalProcessList']) : null;
startBasicDetApprProcessList = json['StartBasicDetApprProcessList'];
startBasicDetApprProcessList = json['StartAddressApprovalProcessList'] != null ? StartAddressApprovalProcess.fromJson(json['StartAddressApprovalProcessList']) : null;
startCeiApprovalProcess = json['StartCeiApprovalProcess'];
startContactApprovalProcessList = json['StartContactApprovalProcessList'];

@ -7,6 +7,7 @@ import 'package:mohem_flutter_app/classes/utils.dart';
import 'package:mohem_flutter_app/config/routes.dart';
import 'package:mohem_flutter_app/generated/locale_keys.g.dart';
import 'package:mohem_flutter_app/main.dart';
import 'package:mohem_flutter_app/models/chat/chat_count_conversation_model.dart';
import 'package:mohem_flutter_app/models/dashboard/drawer_menu_item_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';
@ -34,6 +35,10 @@ class DashboardProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
bool isWorkListLoading = true;
int workListCounter = 0;
//Chat
bool isChatCounterLoding = true;
int chatUConvCounter = 0;
//Misssing Swipe
bool isMissingSwipeLoading = true;
int missingSwipeCounter = 0;
@ -91,6 +96,9 @@ class DashboardProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
accrualList = null;
leaveBalanceAccrual = null;
isChatCounterLoding = true;
chatUConvCounter = 0;
ticketBalance = 0;
isServicesMenusLoading = true;
homeMenus = null;
@ -266,7 +274,18 @@ class DashboardProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
return res;
}
void fetchChatCounts() async {
try {
ChatUnreadCovnCountModel response = await DashboardApiClient().getChatCount();
chatUConvCounter = response.singleChatCount!;
isChatCounterLoding = false;
notifyListeners();
} catch (ex) {
logger.wtf(ex);
notifyListeners();
Utils.handleException(ex, null, null);
}
}
void notify() {
notifyListeners();

@ -98,7 +98,7 @@ class _AddVacationRuleScreenState extends State<AddVacationRuleScreen> {
}
void callCombineApis() async {
try {
try {
Utils.showLoading(context);
List results = await Future.wait([
VacationRuleApiClient().getNotificationReassignMode(),

@ -286,7 +286,7 @@ class _MonthlyAttendanceScreenState extends State<MonthlyAttendanceScreen> {
showWeekNumber: false,
cellBorderColor: Colors.white,
selectionDecoration: BoxDecoration(
border: Border.all(color: MyColors.white, width: 10),
border: Border.all(color: MyColors.white, width: 1),
shape: BoxShape.circle,
),
dataSource: MeetingDataSource(_getDataSource()),
@ -431,7 +431,7 @@ class _MonthlyAttendanceScreenState extends State<MonthlyAttendanceScreen> {
expand: false,
builder: (_, controller) {
dynamic dmyString = getScheduleShiftsDetailsList!.sCHEDULEDATE;
DateTime dateTime1 = DateFormat("MM/dd/yyyy hh:mm:ss a").parse(dmyString);
DateTime dateTime1 = DateFormat("MM/dd/yyyy hh:mm:ss").parse(dmyString);
return Column(
children: [
Container(

@ -0,0 +1,379 @@
import 'dart:ui';
import 'package:camera/camera.dart';
import 'package:flutter/material.dart';
import 'package:mohem_flutter_app/classes/colors.dart';
import 'package:mohem_flutter_app/classes/utils.dart';
import 'package:mohem_flutter_app/models/chat/call.dart';
class IncomingCall extends StatefulWidget {
IncomingCallData incomingCallData;
bool? isVideoCall;
IncomingCall({Key? key, required this.incomingCallData, this.isVideoCall}) : super(key: key);
@override
_IncomingCallState createState() => _IncomingCallState();
}
class _IncomingCallState extends State<IncomingCall> with SingleTickerProviderStateMixin {
AnimationController? _animationController;
CameraController? _controller;
Future<void>? _initializeControllerFuture;
bool isCameraReady = false;
@override
void initState() {
_animationController = AnimationController(
vsync: this,
duration: const Duration(
milliseconds: 500,
),
);
//_runAnimation();
// connectSignaling();
WidgetsBinding.instance.addPostFrameCallback(
(_) => _runAnimation(),
);
super.initState();
}
@override
Widget build(BuildContext context) {
return Scaffold(
body: FutureBuilder<void>(
future: _initializeControllerFuture,
builder: (BuildContext context, AsyncSnapshot<void> snapshot) {
if (snapshot.connectionState == ConnectionState.done) {
return Stack(
alignment: FractionalOffset.center,
children: <Widget>[
if (widget.isVideoCall!)
Positioned.fill(
child: AspectRatio(
aspectRatio: _controller!.value.aspectRatio,
child: CameraPreview(
_controller!,
),
),
),
Positioned.fill(
child: ClipRect(
child: BackdropFilter(
filter: ImageFilter.blur(sigmaX: 10.0, sigmaY: 10.0),
child: Container(
decoration: BoxDecoration(
color: MyColors.grey57Color.withOpacity(
0.7,
),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.max,
children: <Widget>[
Container(
margin: const EdgeInsets.all(21.0),
child: Row(
children: <Widget>[
Image.asset(
"assets/images/logos/main_mohemm_logo.png",
height: 70,
width: 70,
),
Container(
margin: const EdgeInsets.only(
left: 10.0,
right: 10.0,
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: const <Widget>[
Text(
"Aamir Saleem Ahmad",
style: TextStyle(
fontSize: 21,
fontWeight: FontWeight.bold,
color: MyColors.white,
letterSpacing: -1.26,
height: 23 / 12,
),
),
Text(
"Calling...",
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.w600,
color: Color(
0xffC6C6C6,
),
letterSpacing: -0.48,
height: 23 / 24,
),
),
SizedBox(
height: 2,
),
],
),
),
],
),
),
// Container(
// margin: const EdgeInsets.all(21.0),
// width: MediaQuery.of(context).size.width,
// decoration: cardRadius(15.0, color: MyColors.black, elevation: null),
// child: Column(
// crossAxisAlignment: CrossAxisAlignment.start,
// mainAxisSize: MainAxisSize.min,
// children: [
// Container(
// padding: const EdgeInsets.fromLTRB(16.0, 16.0, 16.0, 6.0),
// child: Text(
// "TranslationBase.of(context).appoInfo",
// style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: MyColors.white, letterSpacing: -0.64, height: 23 / 12),
// ),
// ),
// Container(
// padding: const EdgeInsets.only(left: 16.0, right: 16.0),
// child: Text(
// "widget.incomingCallData.appointmentdate + widget.incomingCallData.appointmenttime",
// style: TextStyle(fontSize: 12.0, letterSpacing: -0.48, color: Color(0xff8E8E8E), fontWeight: FontWeight.w600),
// ),
// ),
// Container(
// padding: const EdgeInsets.only(left: 16.0, right: 16.0, bottom: 21.0),
// child: Text(
// "widget.incomingCallData.clinicname",
// style: TextStyle(fontSize: 12.0, letterSpacing: -0.48, color: Color(0xff8E8E8E), fontWeight: FontWeight.w600),
// ),
// ),
// ],
// ),
// ),
const Spacer(),
Container(
margin: const EdgeInsets.only(
bottom: 70.0,
left: 49,
right: 49,
),
child: Row(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
RotationTransition(
turns: Tween(
begin: 0.0,
end: -.1,
)
.chain(
CurveTween(
curve: Curves.elasticIn,
),
)
.animate(
_animationController!,
),
child: RawMaterialButton(
onPressed: () {
_submit();
},
elevation: 2.0,
fillColor: MyColors.green2DColor,
padding: const EdgeInsets.all(
15.0,
),
shape: const CircleBorder(),
child: const Icon(
Icons.call,
color: MyColors.white,
size: 35.0,
),
),
),
RawMaterialButton(
onPressed: () {
backToHome();
},
elevation: 2.0,
fillColor: MyColors.redA3Color,
padding: const EdgeInsets.all(
15.0,
),
shape: const CircleBorder(),
child: const Icon(
Icons.call_end,
color: MyColors.white,
size: 35.0,
),
),
],
),
),
],
),
),
),
),
),
],
);
} else {
return const Center(
child: CircularProgressIndicator(),
);
}
},
),
);
}
void _runAnimation() async {
List<CameraDescription> cameras = await availableCameras();
CameraDescription firstCamera = cameras[1];
_controller = CameraController(
firstCamera,
ResolutionPreset.medium,
);
_initializeControllerFuture = _controller!.initialize();
setState(() {});
// setAudioFile();
for (int i = 0; i < 100; i++) {
await _animationController!.forward();
await _animationController!.reverse();
}
}
Future<void> _submit() async {
try {
// backToHome();
// final roomModel = RoomModel(name: widget.incomingCallData.name, token: widget.incomingCallData.sessionId, identity: widget.incomingCallData.identity);
await _controller?.dispose();
// changeCallStatusAPI(4);
// if (_session != null && _signaling != null) {
// await Navigator.of(context).pushReplacement(
// MaterialPageRoute(
// // fullscreenDialog: true,
// builder: (BuildContext context) {
// // if (widget.incomingCallData.isWebRTC == "true") {
// return StartVideoCall(signaling: _signaling, session: _session);
//
// // else {
// // return OpenTokConnectCallPage(apiKey: OPENTOK_API_KEY, sessionId: widget.incomingCallData.sessionId, token: widget.incomingCallData.token);
// // }
//
// // return VideoCallWebPage(receiverId: widget.incomingCallData.receiverID, callerId: widget.incomingCallData.callerID); // Web WebRTC VideoCall
//
// // return CallHomePage(receiverId: widget.incomingCallData.receiverID, callerId: widget.incomingCallData.callerID); // App WebRTC VideoCall
// },
// ),
// );
// } else {
// // Invalid Params/Data
// Utils.showToast("Failed to establish connection with server");
// }
} catch (err) {
print(err);
// await PlatformExceptionAlertDialog(
// exception: err,
// ).show(context);
Utils.showToast(err.toString());
}
}
// void changeCallStatusAPI(int sessionStatus) {
// LiveCareService service = new LiveCareService();
// service.endCallAPI(widget.incomingCallData.sessionId, sessionStatus, context).then((res) {}).catchError((err) {
// print(err);
// });
// }
void backToHome() async {
// final connected = await signaling.declineCall(widget.incomingCallData.callerID, widget.incomingCallData.receiverID);
// LandingPage.isOpenCallPage = false;
// _signaling
_animationController!.dispose();
// player.stop();
// changeCallStatusAPI(3);
// _signaling.bye(_session, callRejected: true);
// _signaling.callDisconnected(_session, callRejected: true);
Navigator.of(context).pop();
}
//
// void disposeAudioResources() async {
// await player.dispose();
// }
//
// void setAudioFile() async {
// player.stop();
// await player.setVolume(1.0); // full volume
// try {
// await player.setAsset('assets/sounds/ring_60Sec.mp3').then((value) {
// player.setLoopMode(LoopMode.one); // loop ring sound
// player.play();
// }).catchError((err) {
// print("Error: $err");
// });
// } catch (e) {
// print("Error: $e");
// }
// }
//
// void connectSignaling({@required bool iAmCaller = false}) async {
// print("----------------- + Signaling Connection Started ---------------------------");
// var caller = widget.incomingCallData.callerID;
// var receiver = widget.incomingCallData.receiverID;
// var host = widget.incomingCallData.server;
//
// var selfRole = iAmCaller ? "Caller" : "Receiver";
// var selfId = iAmCaller ? caller : receiver;
// var selfUser = SocketUser(id: selfId, name: "$selfRole-$selfId", userAgent: DeviceInfo.userAgent, moreInfo: {});
//
// var remoteRole = !iAmCaller ? "Caller" : "Receiver";
// var remoteId = !iAmCaller ? caller : receiver;
// var remoteUser = SocketUser(id: remoteId, name: "$remoteRole-$remoteId", userAgent: DeviceInfo.userAgent, moreInfo: {});
//
// var sessionId = "$caller-$receiver";
// _session = SessionOneToOne(id: sessionId, local_user: selfUser, remote_user: remoteUser);
//
// _signaling = Signaling(host, session: _session);
// await _signaling.connect();
//
// if (_signaling.state == SignalingState.Open) {
// return;
// }
// }
BoxDecoration cardRadius(double radius, {required Color color, double? elevation}) {
return BoxDecoration(
shape: BoxShape.rectangle,
color: color ?? Colors.white,
borderRadius: BorderRadius.all(
Radius.circular(radius),
),
boxShadow: <BoxShadow>[
BoxShadow(
color: const Color(
0xff000000,
).withOpacity(
.05,
),
//spreadRadius: 5,
blurRadius: elevation ?? 27,
offset: const Offset(
-2,
3,
),
),
],
);
}
}

@ -0,0 +1,428 @@
import 'dart:ui';
import 'package:camera/camera.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:mohem_flutter_app/classes/colors.dart';
import 'package:mohem_flutter_app/classes/utils.dart';
import 'package:mohem_flutter_app/extensions/int_extensions.dart';
import 'package:mohem_flutter_app/models/chat/call.dart';
class OutGoingCall extends StatefulWidget {
IncomingCallData OutGoingCallData;
bool? isVideoCall;
OutGoingCall({Key? key, required this.OutGoingCallData, this.isVideoCall}) : super(key: key);
@override
_OutGoingCallState createState() => _OutGoingCallState();
}
class _OutGoingCallState extends State<OutGoingCall> with SingleTickerProviderStateMixin {
AnimationController? _animationController;
CameraController? _controller;
Future<void>? _initializeControllerFuture;
bool isCameraReady = false;
bool isMicOff = false;
bool isLoudSpeaker = false;
bool isCamOff = false;
@override
void initState() {
_animationController = AnimationController(
vsync: this,
duration: const Duration(
milliseconds: 500,
),
);
//_runAnimation();
// connectSignaling();
WidgetsBinding.instance.addPostFrameCallback(
(_) => _runAnimation(),
);
super.initState();
}
@override
Widget build(BuildContext context) {
return Scaffold(
body: FutureBuilder<void>(
future: _initializeControllerFuture,
builder: (BuildContext context, AsyncSnapshot<void> snapshot) {
if (snapshot.connectionState == ConnectionState.done) {
return Stack(
alignment: FractionalOffset.center,
children: <Widget>[
if (widget.isVideoCall!)
Positioned.fill(
child: AspectRatio(
aspectRatio: _controller!.value.aspectRatio,
child: CameraPreview(
_controller!,
),
),
),
Positioned.fill(
child: ClipRect(
child: BackdropFilter(
filter: ImageFilter.blur(sigmaX: 10.0, sigmaY: 10.0),
child: Container(
decoration: BoxDecoration(
color: MyColors.grey57Color.withOpacity(
0.7,
),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.max,
children: <Widget>[
40.height,
Row(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Container(
margin: const EdgeInsets.all(21.0),
child: Container(
margin: const EdgeInsets.only(
left: 10.0,
right: 10.0,
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: <Widget>[
SvgPicture.asset(
"assets/images/user.svg",
height: 70,
width: 70,
fit: BoxFit.cover,
),
10.height,
const Text(
"Aamir Saleem Ahmad",
style: TextStyle(
fontSize: 21,
fontWeight: FontWeight.bold,
color: MyColors.white,
letterSpacing: -1.26,
height: 23 / 12,
),
),
const Text(
"Ringing...",
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.w600,
color: Color(
0xffC6C6C6,
),
letterSpacing: -0.48,
height: 23 / 24,
),
),
const SizedBox(
height: 2,
),
],
),
),
),
],
),
// Container(
// margin: const EdgeInsets.all(21.0),
// width: MediaQuery.of(context).size.width,
// decoration: cardRadius(15.0, color: MyColors.black, elevation: null),
// child: Column(
// crossAxisAlignment: CrossAxisAlignment.start,
// mainAxisSize: MainAxisSize.min,
// children: [
// Container(
// padding: const EdgeInsets.fromLTRB(16.0, 16.0, 16.0, 6.0),
// child: Text(
// "TranslationBase.of(context).appoInfo",
// style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: MyColors.white, letterSpacing: -0.64, height: 23 / 12),
// ),
// ),
// Container(
// padding: const EdgeInsets.only(left: 16.0, right: 16.0),
// child: Text(
// "widget.OutGoingCallData.appointmentdate + widget.OutGoingCallData.appointmenttime",
// style: TextStyle(fontSize: 12.0, letterSpacing: -0.48, color: Color(0xff8E8E8E), fontWeight: FontWeight.w600),
// ),
// ),
// Container(
// padding: const EdgeInsets.only(left: 16.0, right: 16.0, bottom: 21.0),
// child: Text(
// "widget.OutGoingCallData.clinicname",
// style: TextStyle(fontSize: 12.0, letterSpacing: -0.48, color: Color(0xff8E8E8E), fontWeight: FontWeight.w600),
// ),
// ),
// ],
// ),
// ),
const Spacer(),
Container(
margin: const EdgeInsets.only(
bottom: 70.0,
left: 49,
right: 49,
),
child: Row(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
if (widget.isVideoCall!)
RawMaterialButton(
onPressed: () {
_camOff();
},
elevation: 2.0,
fillColor: isCamOff ? MyColors.green2DColor : Colors.grey,
padding: const EdgeInsets.all(
15.0,
),
shape: const CircleBorder(),
child: Icon(
isCamOff ? Icons.videocam_off : Icons.videocam,
color: MyColors.white,
size: 35.0,
),
)
else
RawMaterialButton(
onPressed: () {
_loudOn();
},
elevation: 2.0,
fillColor: isLoudSpeaker ? MyColors.green2DColor : Colors.grey,
padding: const EdgeInsets.all(
15.0,
),
shape: const CircleBorder(),
child: const Icon(
Icons.volume_up,
color: MyColors.white,
size: 35.0,
),
),
RawMaterialButton(
onPressed: () {
_micOff();
},
elevation: 2.0,
fillColor: isMicOff ? MyColors.green2DColor : Colors.grey,
padding: const EdgeInsets.all(
15.0,
),
shape: const CircleBorder(),
child: Icon(
isMicOff ? Icons.mic_off : Icons.mic,
color: MyColors.white,
size: 35.0,
),
),
RawMaterialButton(
onPressed: () {
backToHome();
},
elevation: 2.0,
fillColor: MyColors.redA3Color,
padding: const EdgeInsets.all(
15.0,
),
shape: const CircleBorder(),
child: const Icon(
Icons.call_end,
color: MyColors.white,
size: 35.0,
),
),
],
),
),
],
),
),
),
),
),
],
);
} else {
return const Center(
child: CircularProgressIndicator(),
);
}
},
),
);
}
void _runAnimation() async {
List<CameraDescription> cameras = await availableCameras();
CameraDescription firstCamera = cameras[1];
_controller = CameraController(
firstCamera,
ResolutionPreset.medium,
);
_initializeControllerFuture = _controller!.initialize();
setState(() {});
// setAudioFile();
for (int i = 0; i < 100; i++) {
await _animationController!.forward();
await _animationController!.reverse();
}
}
void _micOff() {
setState(() {
isMicOff = !isMicOff;
});
}
void _camOff() {
setState(() {
isCamOff = !isCamOff;
});
}
void _loudOn() {
setState(() {
isLoudSpeaker = !isLoudSpeaker;
});
}
Future<void> _submit() async {
try {
// backToHome();
// final roomModel = RoomModel(name: widget.OutGoingCallData.name, token: widget.OutGoingCallData.sessionId, identity: widget.OutGoingCallData.identity);
await _controller?.dispose();
// changeCallStatusAPI(4);
// if (_session != null && _signaling != null) {
// await Navigator.of(context).pushReplacement(
// MaterialPageRoute(
// // fullscreenDialog: true,
// builder: (BuildContext context) {
// // if (widget.OutGoingCallData.isWebRTC == "true") {
// return StartVideoCall(signaling: _signaling, session: _session);
//
// // else {
// // return OpenTokConnectCallPage(apiKey: OPENTOK_API_KEY, sessionId: widget.OutGoingCallData.sessionId, token: widget.OutGoingCallData.token);
// // }
//
// // return VideoCallWebPage(receiverId: widget.OutGoingCallData.receiverID, callerId: widget.OutGoingCallData.callerID); // Web WebRTC VideoCall
//
// // return CallHomePage(receiverId: widget.OutGoingCallData.receiverID, callerId: widget.OutGoingCallData.callerID); // App WebRTC VideoCall
// },
// ),
// );
// } else {
// // Invalid Params/Data
// Utils.showToast("Failed to establish connection with server");
// }
} catch (err) {
print(err);
// await PlatformExceptionAlertDialog(
// exception: err,
// ).show(context);
Utils.showToast(err.toString());
}
}
// void changeCallStatusAPI(int sessionStatus) {
// LiveCareService service = new LiveCareService();
// service.endCallAPI(widget.OutGoingCallData.sessionId, sessionStatus, context).then((res) {}).catchError((err) {
// print(err);
// });
// }
void backToHome() async {
// final connected = await signaling.declineCall(widget.OutGoingCallData.callerID, widget.OutGoingCallData.receiverID);
// LandingPage.isOpenCallPage = false;
// _signaling
_animationController!.dispose();
// player.stop();
// changeCallStatusAPI(3);
// _signaling.bye(_session, callRejected: true);
// _signaling.callDisconnected(_session, callRejected: true);
Navigator.of(context).pop();
}
//
// void disposeAudioResources() async {
// await player.dispose();
// }
//
// void setAudioFile() async {
// player.stop();
// await player.setVolume(1.0); // full volume
// try {
// await player.setAsset('assets/sounds/ring_60Sec.mp3').then((value) {
// player.setLoopMode(LoopMode.one); // loop ring sound
// player.play();
// }).catchError((err) {
// print("Error: $err");
// });
// } catch (e) {
// print("Error: $e");
// }
// }
//
// void connectSignaling({@required bool iAmCaller = false}) async {
// print("----------------- + Signaling Connection Started ---------------------------");
// var caller = widget.OutGoingCallData.callerID;
// var receiver = widget.OutGoingCallData.receiverID;
// var host = widget.OutGoingCallData.server;
//
// var selfRole = iAmCaller ? "Caller" : "Receiver";
// var selfId = iAmCaller ? caller : receiver;
// var selfUser = SocketUser(id: selfId, name: "$selfRole-$selfId", userAgent: DeviceInfo.userAgent, moreInfo: {});
//
// var remoteRole = !iAmCaller ? "Caller" : "Receiver";
// var remoteId = !iAmCaller ? caller : receiver;
// var remoteUser = SocketUser(id: remoteId, name: "$remoteRole-$remoteId", userAgent: DeviceInfo.userAgent, moreInfo: {});
//
// var sessionId = "$caller-$receiver";
// _session = SessionOneToOne(id: sessionId, local_user: selfUser, remote_user: remoteUser);
//
// _signaling = Signaling(host, session: _session);
// await _signaling.connect();
//
// if (_signaling.state == SignalingState.Open) {
// return;
// }
// }
BoxDecoration cardRadius(double radius, {required Color color, double? elevation}) {
return BoxDecoration(
shape: BoxShape.rectangle,
color: color ?? Colors.white,
borderRadius: BorderRadius.all(
Radius.circular(radius),
),
boxShadow: <BoxShadow>[
BoxShadow(
color: const Color(
0xff000000,
).withOpacity(
.05,
),
//spreadRadius: 5,
blurRadius: elevation ?? 27,
offset: const Offset(
-2,
3,
),
),
],
);
}
}

@ -2,80 +2,142 @@ 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:sizer/sizer.dart';
class ChatBubble extends StatelessWidget {
const ChatBubble(
{Key? key,
required this.text,
required this.replyText,
required this.isCurrentUser,
required this.isSeen,
required this.isDelivered,
required this.dateTime})
required this.dateTime,
required this.isReplied,
required this.userName})
: super(key: key);
final String text;
final String replyText;
final bool isCurrentUser;
final bool isSeen;
final bool isDelivered;
final String dateTime;
final bool isReplied;
final String userName;
@override
Widget build(BuildContext context) {
return Padding(
// asymmetric padding
padding: EdgeInsets.fromLTRB(
isCurrentUser ? 64.0 : 16.0,
4,
isCurrentUser ? 16.0 : 64.0,
4,
// padding: EdgeInsets.zero,
padding: EdgeInsets.only(
left: isCurrentUser ? 110 : 20,
right: isCurrentUser ? 20 : 110,
bottom: 9,
),
child: Align(
// align the child within the container
alignment: isCurrentUser ? Alignment.centerRight : Alignment.centerLeft,
child: DecoratedBox(
// chat bubble decoration
decoration: BoxDecoration(
color: Colors.white,
color: MyColors.white,
gradient: isCurrentUser
? null
: LinearGradient(
transform: GradientRotation(.46),
: const LinearGradient(
transform: GradientRotation(
.46,
),
begin: Alignment.topRight,
end: Alignment.bottomLeft,
colors: [
MyColors.gradiantEndColor,
MyColors.gradiantStartColor,
]),
borderRadius: BorderRadius.circular(10),
colors: <Color>[
MyColors.gradiantEndColor,
MyColors.gradiantStartColor,
],
),
borderRadius: BorderRadius.circular(
10,
),
),
child: Padding(
padding: const EdgeInsets.all(12),
padding: EdgeInsets.only(
top: isReplied ? 8 : 5,
right: 8,
left: 8,
bottom: 5,
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start,
children: [
if (isReplied)
ClipRRect(
borderRadius: BorderRadius.circular(
5.0,
),
child: Container(
decoration: BoxDecoration(
border: Border(
left: BorderSide(
width: 6,
color: isCurrentUser ? MyColors.gradiantStartColor : MyColors.white,
),
),
color: isCurrentUser ? MyColors.black.withOpacity(0.10) : MyColors.black.withOpacity(0.30),
),
child: Row(
children: [
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
(userName)
.toText12(
color: MyColors.gradiantStartColor,
isBold: false,
)
.paddingOnly(
right: 5,
top: 5,
bottom: 0,
left: 5,
),
replyText
.toText10(
color: isCurrentUser ? MyColors.grey71Color : MyColors.white.withOpacity(0.5),
isBold: false,
maxlines: 4,
)
.paddingOnly(
right: 5,
top: 5,
bottom: 8,
left: 5,
),
],
),
),
],
),
),
),
if (isReplied) 8.height,
text.toText12(
color:
isCurrentUser ? MyColors.grey57Color : MyColors.white),
8.height,
color: isCurrentUser ? MyColors.grey57Color : MyColors.white,
),
Row(
crossAxisAlignment: CrossAxisAlignment.end,
mainAxisAlignment: MainAxisAlignment.end,
children: [
children: <Widget>[
dateTime.toText12(
color: isCurrentUser
? MyColors.grey41Color.withOpacity(.5)
: Colors.white.withOpacity(0.7)),
color: isCurrentUser ? MyColors.grey41Color.withOpacity(.5) : MyColors.white.withOpacity(0.7),
),
if (isCurrentUser) 5.width,
if (isCurrentUser)
Icon(
isDelivered
? Icons.done_all
: Icons.done_all,
color: isSeen
? MyColors.textMixColor
: MyColors.grey9DColor,
size: 14,
)
// if (isCurrentUser)
// Icon(
// isDelivered ? Icons.done_all : Icons.done_all,
// color: isSeen ? MyColors.textMixColor : MyColors.grey9DColor,
// size: 14,
// ),
],
),
],

@ -1,109 +1,397 @@
import 'dart:async';
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:mohem_flutter_app/api/chat/chat_provider_model.dart';
import 'package:mohem_flutter_app/app_state/app_state.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/chat/call.dart';
import 'package:mohem_flutter_app/ui/chat/call/chat_outgoing_call_screen.dart';
import 'package:mohem_flutter_app/ui/chat/chat_bubble.dart';
import 'package:mohem_flutter_app/widgets/app_bar_widget.dart';
import 'package:mohem_flutter_app/widgets/shimmer/dashboard_shimmer_widget.dart';
import 'package:provider/provider.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart';
import 'package:swipe_to/swipe_to.dart';
class ChatDetailScreen extends StatefulWidget {
// ignore: prefer_const_constructors_in_immutables
ChatDetailScreen({Key? key}) : super(key: key);
class ChatDetailScreen extends StatelessWidget {
@override
State<ChatDetailScreen> createState() => _ChatDetailScreenState();
}
class _ChatDetailScreenState extends State<ChatDetailScreen> {
dynamic userDetails;
late ChatProviderModel data;
final RefreshController _rc = RefreshController(initialRefresh: false);
ChatDetailScreen({Key? key}) : super(key: key);
void getMoreChat() async {
if (userDetails != null) {
data.paginationVal = data.paginationVal + 10;
if (userDetails != null)
data.getSingleUserChatHistory(
senderUID: AppState().chatDetails!.response!.id!.toInt(),
receiverUID: userDetails["targetUser"].id,
loadMore: true,
isNewChat: false,
);
}
await Future.delayed(
const Duration(
milliseconds: 1000,
),
);
_rc.loadComplete();
}
@override
Widget build(BuildContext context) {
userDetails = ModalRoute
.of(context)!
.settings
.arguments;
userDetails = ModalRoute.of(context)!.settings.arguments;
data = Provider.of<ChatProviderModel>(context, listen: false);
data.getSingleUserChatHistory(senderUID: AppState().chatDetails!.response!.id.toString(), receiverUID: userDetails["targetUser"].id, pagination: "0");
Timer(const Duration(seconds: 1), () => data.scrollDown());
if (userDetails != null)
data.getSingleUserChatHistory(
senderUID: AppState().chatDetails!.response!.id!.toInt(),
receiverUID: userDetails["targetUser"].id,
loadMore: false,
isNewChat: userDetails["isNewChat"],
);
return Scaffold(
backgroundColor: const Color(0xFFF8F8F8),
appBar: AppBarWidget(context, title: userDetails["targetUser"].userName, showHomeButton: false, image: userDetails["targetUser"].image),
appBar: AppBarWidget(context,
title: userDetails["targetUser"].userName.toString().replaceAll(".", " ").capitalizeFirstofEach,
showHomeButton: false,
image: userDetails["targetUser"].image,
actions: [
IconButton(
onPressed: () {
makeCall("AUDIO");
},
icon: SvgPicture.asset(
"assets/icons/chat/call.svg",
width: 22,
height: 22,
),
),
IconButton(
onPressed: () {
makeCall("VIDEO");
},
icon: SvgPicture.asset(
"assets/icons/chat/video_call.svg",
width: 20,
height: 20,
),
),
10.width,
]),
body: Consumer<ChatProviderModel>(
builder: (BuildContext context, ChatProviderModel m, Widget? child) {
return (m.isLoading
? ChatHomeShimmer()
: Column(
children: <Widget>[
Expanded(
child: ListView.builder(
controller: m.scrollController,
shrinkWrap: true,
itemCount: m.userChatHistory.length,
padding: const EdgeInsets.symmetric(vertical: 10),
itemBuilder: (BuildContext context, int i) {
i == 0 ? m.logger.d(m.userChatHistory.length) : "";
return ChatBubble(
text: m.userChatHistory[i].contant.toString(),
isSeen: m.userChatHistory[i].isSeen == true ? true : false,
isCurrentUser: m.userChatHistory[i].currentUserId == AppState().chatDetails!.response!.id ? true : false,
isDelivered: m.userChatHistory[i].currentUserId == AppState().chatDetails!.response!.id && m.userChatHistory[i].isDelivered == true ? true : false,
dateTime: m.userChatHistory[i].createdDate.toString(),
);
},
),
),
Card(
margin: EdgeInsets.zero,
child: Padding(
padding: const EdgeInsets.symmetric(vertical: 10),
child: TextField(
controller: m.message,
decoration: InputDecoration(
hintText: LocaleKeys.typeheretoreply.tr(),
hintStyle: const TextStyle(color: MyColors.grey98Color),
border: InputBorder.none,
focusedBorder: InputBorder.none,
enabledBorder: InputBorder.none,
errorBorder: InputBorder.none,
disabledBorder: InputBorder.none,
contentPadding: const EdgeInsets.symmetric(vertical: 10, horizontal: 15),
suffixIcon: SizedBox(
width: 100,
child: Row(
crossAxisAlignment: CrossAxisAlignment.end,
mainAxisAlignment: MainAxisAlignment.end,
children: [
IconButton(
icon: const Icon(
Icons.attach_file_rounded,
size: 27,
color: MyColors.lightGreenColor,
children: <Widget>[
Expanded(
flex: 2,
child: SmartRefresher(
enablePullDown: false,
enablePullUp: true,
onLoading: () {
getMoreChat();
},
header: const MaterialClassicHeader(
color: MyColors.gradiantEndColor,
),
controller: _rc,
reverse: true,
child: ListView.builder(
controller: m.scrollController,
shrinkWrap: true,
physics: const BouncingScrollPhysics(),
reverse: true,
itemCount: m.userChatHistory.length,
padding: const EdgeInsets.only(top: 20),
itemBuilder: (BuildContext context, int i) {
return SwipeTo(
iconColor: MyColors.lightGreenColor,
child: ChatBubble(
text: m.userChatHistory[i].contant.toString(),
replyText: m.userChatHistory[i].userChatReplyResponse != null ? m.userChatHistory[i].userChatReplyResponse!.contant.toString() : "",
isSeen: m.userChatHistory[i].isSeen == true ? true : false,
isCurrentUser: m.userChatHistory[i].currentUserId == AppState().chatDetails!.response!.id ? true : false,
isDelivered: m.userChatHistory[i].currentUserId == AppState().chatDetails!.response!.id && m.userChatHistory[i].isDelivered == true ? true : false,
dateTime: m.dateFormte(m.userChatHistory[i].createdDate!),
isReplied: m.userChatHistory[i].userChatReplyResponse != null ? true : false,
userName: AppState().chatDetails!.response!.userName == m.userChatHistory[i].currentUserName.toString() ? "You" : m.userChatHistory[i].currentUserName.toString(),
),
onRightSwipe: () {
m.chatReply(
m.userChatHistory[i],
);
},
);
},
),
),
),
if (m.isMsgReply)
Row(
children: <Widget>[
Container(
height: 80,
color: MyColors.textMixColor,
width: 6,
),
Expanded(
child: Container(
height: 80,
color: MyColors.black.withOpacity(0.10),
child: ListTile(
title: (AppState().chatDetails!.response!.userName == m.repliedMsg.first.currentUserName.toString()
? "You"
: m.repliedMsg.first.currentUserName.toString().replaceAll(".", " "))
.toText14(color: MyColors.lightGreenColor),
subtitle: (m.repliedMsg.isNotEmpty ? m.repliedMsg.first.contant! : "").toText12(
color: MyColors.white,
maxLine: 2,
),
trailing: GestureDetector(
onTap: m.closeMe,
child: Container(
decoration: BoxDecoration(
color: MyColors.white.withOpacity(0.5),
borderRadius: const BorderRadius.all(
Radius.circular(20),
),
),
child: const Icon(
Icons.close,
size: 23,
color: MyColors.white,
),
),
),
),
onPressed: () {},
),
IconButton(
icon: SvgPicture.asset(
"assets/icons/chat/chat_send_icon.svg",
height: 26,
width: 35,
),
],
),
if (m.isFileSelected && m.sFileType == ".png" || m.sFileType == ".jpeg" || m.sFileType == ".jpg")
Card(
margin: EdgeInsets.zero,
elevation: 0,
child: Padding(
padding: const EdgeInsets.only(
left: 20,
right: 20,
top: 20,
bottom: 0,
),
child: Card(
margin: EdgeInsets.zero,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(0),
),
elevation: 0,
child: Container(
height: 200,
decoration: BoxDecoration(
image: DecorationImage(
image: FileImage(
m.selectedFile,
),
fit: BoxFit.cover,
),
borderRadius: const BorderRadius.all(
Radius.circular(0),
),
),
child: const SizedBox(
width: double.infinity,
height: 200,
),
onPressed: () {
m.sendChatMessage(m.message.text, userDetails["targetUser"].id, userDetails["targetUser"].userName);
},
),
],
),
),
),
Card(
margin: EdgeInsets.zero,
child: TextField(
controller: m.message,
decoration: InputDecoration(
hintText: m.isFileSelected ? m.selectedFile.path.split("/").last : LocaleKeys.typeheretoreply.tr(),
hintStyle: TextStyle(
color: m.isFileSelected ? MyColors.darkTextColor : MyColors.grey98Color,
fontSize: 14,
),
border: InputBorder.none,
focusedBorder: InputBorder.none,
enabledBorder: InputBorder.none,
errorBorder: InputBorder.none,
disabledBorder: InputBorder.none,
contentPadding: EdgeInsets.only(
left: m.sFileType.isNotEmpty ? 10 : 20,
right: m.sFileType.isNotEmpty ? 0 : 5,
top: 20,
bottom: 20,
),
prefixIcon: m.sFileType.isNotEmpty
? Row(
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
SvgPicture.asset(
m.getType(m.sFileType),
height: 30,
width: 25,
alignment: Alignment.center,
fit: BoxFit.cover,
).paddingOnly(left: 20),
],
)
: null,
suffixIcon: SizedBox(
width: 96,
child: Row(
mainAxisAlignment: MainAxisAlignment.end,
crossAxisAlignment: CrossAxisAlignment.center, // added line
children: <Widget>[
if (m.sFileType.isNotEmpty)
IconButton(
padding: EdgeInsets.zero,
alignment: Alignment.centerRight,
icon: Row(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.end,
mainAxisSize: MainAxisSize.max,
children: <Widget>[
Container(
decoration: const BoxDecoration(
color: MyColors.redA3Color,
borderRadius: BorderRadius.all(
Radius.circular(20),
),
),
child: const Icon(
Icons.close,
size: 15,
color: MyColors.white,
),
),
("Clear")
.toText11(
color: MyColors.redA3Color,
)
.paddingOnly(
left: 4,
),
],
),
onPressed: () async {
m.removeAttachment();
},
),
if (m.sFileType.isEmpty)
RotationTransition(
turns: const AlwaysStoppedAnimation(45 / 360),
child: IconButton(
padding: EdgeInsets.zero,
alignment: Alignment.topRight,
icon: const Icon(
Icons.attach_file_rounded,
size: 26,
color: MyColors.grey3AColor,
),
onPressed: () async {
m.selectImageToUpload(context);
},
),
),
IconButton(
alignment: Alignment.centerRight,
padding: EdgeInsets.zero,
icon: SvgPicture.asset(
"assets/icons/chat/chat_send_icon.svg",
height: 26,
width: 26,
),
onPressed: () {
m.sendChatMessage(
userDetails["targetUser"].id,
userDetails["targetUser"].userName,
context,
);
},
)
],
),
).paddingOnly(
right: 20,
),
),
),
),
),
),
),
],
));
],
));
},
),
);
}
void makeCall(String callType) async {
// final server = await SelectionDialog(
// context,
// title: "Select Server",
// items: ["https://livecareturn.hmg.com:8086", "https://104.197.179.1:8086"]
// ).show();
Map<String, String> json = {
"callerID": "9920",
"PatientID": "1231755",
"msgID": "123",
"notfID": "123",
"notification_foreground": "true",
"count": "1",
"message": "Doctor is calling ",
"AppointmentNo": "123",
"title": "Rayyan Hospital",
"ProjectID": "123",
"NotificationType": "10",
"background": "1",
"doctorname": "Dr Sulaiman Al Habib",
"clinicname": "ENT Clinic",
"speciality": "Speciality",
"appointmentdate": "Sun, 15th Dec, 2019",
"appointmenttime": "09:00",
"type": "video",
"session_id":
"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiIsImN0eSI6InR3aWxpby1mcGE7dj0xIn0.eyJqdGkiOiJTS2I2NjYyOWMzN2ZhOTM3YjFjNDI2Zjg1MTgyNWFmN2M0LTE1OTg3NzQ1MDYiLCJpc3MiOiJTS2I2NjYyOWMzN2ZhOTM3YjFjNDI2Zjg1MTgyNWFmN2M0Iiwic3ViIjoiQUNhYWQ1YTNmOGM2NGZhNjczNTY3NTYxNTc0N2YyNmMyYiIsImV4cCI6MTU5ODc3ODEwNiwiZ3JhbnRzIjp7ImlkZW50aXR5IjoiSGFyb29uMSIsInZpZGVvIjp7InJvb20iOiJTbWFsbERhaWx5U3RhbmR1cCJ9fX0.7XUS5uMQQJfkrBZu9EjQ6STL6R7iXkso6BtO1HmrQKk",
"identity": "Haroon1",
"name": "SmallDailyStandup",
"videoUrl": "video",
"picture": "video",
"is_call": "true",
"is_webrtc": "true",
// "server": "https://192.168.8.163:8086",
"server": "https://livecareturn.hmg.com:8086",
};
IncomingCallData incomingCallData = IncomingCallData.fromJson(json);
await Navigator.push(
context,
MaterialPageRoute(
builder: (BuildContext context) => OutGoingCall(
isVideoCall: callType == "VIDEO" ? true : false,
OutGoingCallData: incomingCallData,
),
),
);
}
}

@ -1,179 +1,132 @@
import 'dart:convert';
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:mohem_flutter_app/api/chat/chat_provider_model.dart';
import 'package:mohem_flutter_app/app_state/app_state.dart';
import 'package:mohem_flutter_app/classes/colors.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';
import 'package:mohem_flutter_app/extensions/widget_extensions.dart';
import 'package:mohem_flutter_app/generated/locale_keys.g.dart';
import 'package:mohem_flutter_app/ui/chat/chat_home_screen.dart';
import 'package:mohem_flutter_app/ui/chat/favorite_users_screen.dart';
import 'package:mohem_flutter_app/ui/screens/items_for_sale/fragments/items_for_sale.dart';
import 'package:mohem_flutter_app/ui/screens/items_for_sale/fragments/my_posted_ads_fragment.dart';
import 'package:mohem_flutter_app/widgets/app_bar_widget.dart';
import 'package:mohem_flutter_app/widgets/bottom_sheet.dart';
import 'package:mohem_flutter_app/widgets/bottom_sheets/search_employee_bottom_sheet.dart';
import 'package:mohem_flutter_app/widgets/shimmer/dashboard_shimmer_widget.dart';
import 'package:provider/provider.dart';
class ChatHomeScreen extends StatefulWidget {
const ChatHomeScreen({Key? key}) : super(key: key);
class ChatHome extends StatefulWidget {
const ChatHome({Key? key}) : super(key: key);
@override
State<ChatHomeScreen> createState() => _ChatHomeScreenState();
State<ChatHome> createState() => _ChatHomeState();
}
class _ChatHomeScreenState extends State<ChatHomeScreen> {
TextEditingController search = new TextEditingController();
class _ChatHomeState extends State<ChatHome> {
int tabIndex = 0;
PageController controller = PageController();
late ChatProviderModel data;
@override
void initState() {
// TODO: implement initState
super.initState();
data = Provider.of<ChatProviderModel>(context, listen: false);
data.getUserAutoLoginToken().whenComplete(() {
data.getUserAutoLoginToken().then((Object? value) {
data.getUserRecentChats();
});
}
@override
void dispose() {
data.clearAll();
if (data.hubConInitialized) {
data.hubConnection.stop();
}
super.dispose();
}
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.white,
appBar: AppBarWidget(context, title: LocaleKeys.mychats.tr(), showHomeButton: false),
body: Consumer<ChatProviderModel>(builder: (BuildContext context, ChatProviderModel m, Widget? child) {
return m.isLoading
? ChatHomeShimmer()
: ListView(
shrinkWrap: true,
physics: const AlwaysScrollableScrollPhysics(),
children: [
Padding(
padding: const EdgeInsets.symmetric(vertical: 0, horizontal: 20),
child: TextField(
onChanged: (String val) {
m.filter(val);
},
decoration: InputDecoration(
border: InputBorder.none,
focusedBorder: InputBorder.none,
enabledBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(5),
borderSide: const BorderSide(
color: Color(0xFFE5E5E5),
),
),
errorBorder: InputBorder.none,
disabledBorder: InputBorder.none,
contentPadding: const EdgeInsets.symmetric(horizontal: 15, vertical: 10),
hintText: "Search from chat",
hintStyle: const TextStyle(color: MyColors.lightTextColor, fontStyle: FontStyle.italic),
filled: true,
fillColor: const Color(0xFFF7F7F7),
),
),
),
if (m.searchedChats != null)
ListView.separated(
itemCount: m.searchedChats!.length,
padding: const EdgeInsets.only(top: 0),
shrinkWrap: true,
physics: const NeverScrollableScrollPhysics(),
itemBuilder: (BuildContext context, int index) {
return ListTile(
leading: Stack(
children: [
SvgPicture.asset(
"assets/images/user.svg",
height: 48,
width: 48,
),
Positioned(
right: 5,
bottom: 1,
child: Container(
width: 10,
height: 10,
decoration: BoxDecoration(
color: m.searchedChats![index].userStatus == 1 ? MyColors.green2DColor : Colors.red,
borderRadius: const BorderRadius.all(
Radius.circular(10),
),
),
),
)
],
),
title: (m.searchedChats![index].userName ?? "").toText14(color: MyColors.darkTextColor),
subtitle: (m.searchedChats![index].isTyping == true ? "Typing ..." : "").toText11(color: MyColors.normalTextColor),
trailing: ("Today").toText10(color: MyColors.lightTextColor),
minVerticalPadding: 0,
onTap: () {
Navigator.pushNamed(
context,
AppRoutes.chatDetailed,
arguments: {"targetUser": m.searchedChats![index]},
);
},
);
},
separatorBuilder: (BuildContext context, int index) => const Padding(
padding: EdgeInsets.only(right: 10, left: 70),
child: Divider(
color: Color(0xFFE5E5E5),
),
),
),
// if (searchedUsersList == null) Utils.getNoChatWidget(context),
backgroundColor: MyColors.white,
appBar: AppBarWidget(
context,
title: LocaleKeys.chat.tr(),
showHomeButton: true,
),
body: Column(
children: <Widget>[
Container(
padding: const EdgeInsets.only(left: 21, right: 21, top: 16, bottom: 16),
decoration: const BoxDecoration(
borderRadius: BorderRadius.only(
bottomLeft: Radius.circular(25),
bottomRight: Radius.circular(25),
),
gradient: LinearGradient(
transform: GradientRotation(.83),
begin: Alignment.topRight,
end: Alignment.bottomLeft,
colors: <Color>[
MyColors.gradiantEndColor,
MyColors.gradiantStartColor,
],
);
}),
floatingActionButton: FloatingActionButton(
child: Container(
width: 60,
height: 60,
decoration: const BoxDecoration(
shape: BoxShape.circle,
gradient: LinearGradient(
transform: GradientRotation(.46),
begin: Alignment.topRight,
end: Alignment.bottomLeft,
colors: [
MyColors.gradiantEndColor,
MyColors.gradiantStartColor,
),
),
child: Row(
children: <Widget>[
myTab(LocaleKeys.mychats.tr(), 0),
myTab(LocaleKeys.favorite.tr(), 1),
],
),
),
child: const Icon(
Icons.add,
size: 30,
color: MyColors.white,
),
),
onPressed: () async {
// var userData = await ChatApiClient()
// .getChatMemberFromSearch("aamir.muhammad", 36239);
showMyBottomSheet(
context,
callBackFunc: (){},
child: SearchEmployeeBottomSheet(
title: LocaleKeys.searchForEmployee.tr(),
apiMode: LocaleKeys.delegate.tr(),
fromChat: true,
onSelectEmployee: (_selectedEmployee) {
// Navigator.pop(context);
// selectedReplacementEmployee = _selectedEmployee;
setState(() {});
},
),
);
},
PageView(
controller: controller,
physics: const NeverScrollableScrollPhysics(),
onPageChanged: (int pageIndex) {
setState(() {
tabIndex = pageIndex;
});
},
children: <Widget>[
ChatHomeScreen(),
ChatFavoriteUsersScreen(),
],
).expanded,
],
),
);
}
Widget myTab(String title, int index) {
bool isSelected = (index == tabIndex);
return Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
title.toText12(
color: isSelected ? MyColors.white : MyColors.white.withOpacity(.74),
isCenter: true,
),
4.height,
Container(
height: 8,
width: 8,
decoration: BoxDecoration(
shape: BoxShape.circle,
color: isSelected ? MyColors.white : Colors.transparent,
),
).onPress(() {
setState(() {
// showFabOptions = true;
});
})
],
).onPress(() {
controller.jumpToPage(index);
}).expanded;
}
}

@ -0,0 +1,268 @@
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:mohem_flutter_app/api/chat/chat_provider_model.dart';
import 'package:mohem_flutter_app/app_state/app_state.dart';
import 'package:mohem_flutter_app/classes/colors.dart';
import 'package:mohem_flutter_app/config/routes.dart';
import 'package:mohem_flutter_app/extensions/string_extensions.dart';
import 'package:mohem_flutter_app/generated/locale_keys.g.dart';
import 'package:mohem_flutter_app/widgets/bottom_sheet.dart';
import 'package:mohem_flutter_app/widgets/bottom_sheets/search_employee_bottom_sheet.dart';
import 'package:mohem_flutter_app/widgets/shimmer/dashboard_shimmer_widget.dart';
import 'package:provider/provider.dart';
class ChatHomeScreen extends StatefulWidget {
@override
State<ChatHomeScreen> createState() => _ChatHomeScreenState();
}
class _ChatHomeScreenState extends State<ChatHomeScreen> {
TextEditingController search = TextEditingController();
@override
void dispose() {
super.dispose();
search.clear();
}
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: MyColors.white,
body: Consumer<ChatProviderModel>(
builder: (BuildContext context, ChatProviderModel m, Widget? child) {
return m.isLoading
? ChatHomeShimmer()
: ListView(
shrinkWrap: true,
physics: const AlwaysScrollableScrollPhysics(),
children: <Widget>[
Padding(
padding: const EdgeInsets.symmetric(
vertical: 20,
horizontal: 20,
),
child: TextField(
controller: m.search,
onChanged: (String val) {
m.filter(val);
},
decoration: InputDecoration(
border: fieldBorder(
radius: 5,
color: 0xFFE5E5E5,
),
focusedBorder: fieldBorder(
radius: 5,
color: 0xFFE5E5E5,
),
enabledBorder: fieldBorder(
radius: 5,
color: 0xFFE5E5E5,
),
contentPadding: const EdgeInsets.symmetric(
horizontal: 15,
vertical: 10,
),
hintText: LocaleKeys.searchfromchat.tr(),
hintStyle: const TextStyle(
color: MyColors.lightTextColor,
fontStyle: FontStyle.italic,
),
filled: true,
fillColor: const Color(
0xFFF7F7F7,
),
suffixIcon: m.search.text.isNotEmpty
? IconButton(
onPressed: () {
m.clearSelections();
},
icon: const Icon(
Icons.clear,
size: 22,
),
color: MyColors.redA3Color,
)
: null,
),
),
),
if (m.searchedChats != null)
ListView.separated(
itemCount: m.searchedChats!.length,
padding: const EdgeInsets.only(
bottom: 80,
),
shrinkWrap: true,
physics: const NeverScrollableScrollPhysics(),
itemBuilder: (BuildContext context, int index) {
return SizedBox(
height: 55,
child: ListTile(
leading: Stack(
children: <Widget>[
SvgPicture.asset(
"assets/images/user.svg",
height: 48,
width: 48,
),
Positioned(
right: 5,
bottom: 1,
child: Container(
width: 10,
height: 10,
decoration: BoxDecoration(
color: m.searchedChats![index].userStatus == 1 ? MyColors.green2DColor : Colors.red,
borderRadius: const BorderRadius.all(
Radius.circular(10),
),
),
),
)
],
),
title: (m.searchedChats![index].userName!.replaceFirst(".", " ").capitalizeFirstofEach ?? "").toText14(color: MyColors.darkTextColor),
// subtitle: (m.searchedChats![index].isTyping == true ? "Typing ..." : "").toText11(color: MyColors.normalTextColor),
trailing: SizedBox(
width: 60,
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.end,
mainAxisSize: MainAxisSize.max,
children: <Widget>[
// if (m.searchedChats![index].unreadMessageCount != null)
// Flexible(
// child: Container(
// padding: EdgeInsets.zero,
// alignment: Alignment.centerRight,
// width: 18,
// height: 18,
// decoration: const BoxDecoration(
// color: MyColors.redColor,
// borderRadius: BorderRadius.all(
// Radius.circular(20),
// ),
// ),
// child: (m.searchedChats![index].unreadMessageCount!.toString())
// .toText10(
// color: MyColors.white,
// )
// .center,
// ),
// ),
Flexible(
child: IconButton(
alignment: Alignment.centerRight,
padding: EdgeInsets.zero,
icon: Icon(
m.searchedChats![index].isFav != null && m.searchedChats![index].isFav == false ? Icons.star_sharp : Icons.star_sharp,
),
color: m.searchedChats![index].isFav != null && m.searchedChats![index].isFav == true ? MyColors.yellowColor : MyColors.grey35Color,
onPressed: () {
if (m.searchedChats![index].isFav == null || m.searchedChats![index].isFav == false) {
m.favoriteUser(
userID: AppState().chatDetails!.response!.id!,
targetUserID: m.searchedChats![index].id!,
);
} else if (m.searchedChats![index].isFav == true) {
m.unFavoriteUser(
userID: AppState().chatDetails!.response!.id!,
targetUserID: m.searchedChats![index].id!,
);
} else {
m.favoriteUser(
userID: AppState().chatDetails!.response!.id!,
targetUserID: m.searchedChats![index].id!,
);
}
},
),
)
],
),
),
minVerticalPadding: 0,
onTap: () {
Navigator.pushNamed(
context,
AppRoutes.chatDetailed,
arguments: {"targetUser": m.searchedChats![index], "isNewChat": false},
).then((Object? value) {
m.clearSelections();
m.notifyListeners();
});
},
),
);
},
separatorBuilder: (BuildContext context, int index) => const Padding(
padding: EdgeInsets.only(
right: 10,
left: 70,
),
child: Divider(
color: Color(
0xFFE5E5E5,
),
),
),
),
],
);
},
),
floatingActionButton: FloatingActionButton(
child: Container(
width: 60,
height: 60,
decoration: const BoxDecoration(
shape: BoxShape.circle,
gradient: LinearGradient(
transform: GradientRotation(.46),
begin: Alignment.topRight,
end: Alignment.bottomLeft,
colors: [
MyColors.gradiantEndColor,
MyColors.gradiantStartColor,
],
),
),
child: const Icon(
Icons.add,
size: 30,
color: MyColors.white,
),
),
onPressed: () async {
showMyBottomSheet(
context,
callBackFunc: () {},
child: SearchEmployeeBottomSheet(
title: LocaleKeys.searchForEmployee.tr(),
apiMode: LocaleKeys.delegate.tr(),
fromChat: true,
onSelectEmployee: (_selectedEmployee) {},
),
);
},
),
);
}
OutlineInputBorder fieldBorder({required double radius, required int color}) {
return OutlineInputBorder(
borderRadius: BorderRadius.circular(
radius,
),
borderSide: BorderSide(
color: Color(
color,
),
),
);
}
}

@ -0,0 +1,114 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:mohem_flutter_app/api/chat/chat_provider_model.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/utils.dart';
import 'package:mohem_flutter_app/config/routes.dart';
import 'package:mohem_flutter_app/extensions/string_extensions.dart';
import 'package:mohem_flutter_app/extensions/widget_extensions.dart';
import 'package:mohem_flutter_app/widgets/shimmer/dashboard_shimmer_widget.dart';
import 'package:provider/provider.dart';
class ChatFavoriteUsersScreen extends StatelessWidget {
const ChatFavoriteUsersScreen({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: MyColors.white,
body: Consumer<ChatProviderModel>(
builder: (BuildContext context, ChatProviderModel m, Widget? child) {
if (m.isLoading) {
return ChatHomeShimmer();
} else {
return m.favUsersList != null && m.favUsersList.isNotEmpty
? ListView.separated(
itemCount: m.favUsersList!.length,
padding: const EdgeInsets.only(top: 20),
shrinkWrap: true,
physics: const NeverScrollableScrollPhysics(),
itemBuilder: (BuildContext context, int index) {
return SizedBox(
height: 55,
child: ListTile(
leading: Stack(
children: <Widget>[
SvgPicture.asset(
"assets/images/user.svg",
height: 48,
width: 48,
),
Positioned(
right: 5,
bottom: 1,
child: Container(
width: 10,
height: 10,
decoration: BoxDecoration(
color: m.favUsersList![index].userStatus == 1 ? MyColors.green2DColor : Colors.red,
borderRadius: const BorderRadius.all(
Radius.circular(10),
),
),
),
)
],
),
title: (m.favUsersList![index].userName!.replaceFirst(".", " ").capitalizeFirstofEach ?? "").toText14(
color: MyColors.darkTextColor,
),
trailing: IconButton(
alignment: Alignment.centerRight,
padding: EdgeInsets.zero,
icon: Icon(
m.favUsersList![index].isFav! ? Icons.star : Icons.star_border,
),
color: m.favUsersList![index].isFav! ? MyColors.yellowColor : MyColors.grey35Color,
onPressed: () {
if (m.favUsersList![index].isFav!)
m.unFavoriteUser(
userID: AppState().chatDetails!.response!.id!,
targetUserID: m.favUsersList![index].id!,
);
},
),
minVerticalPadding: 0,
onTap: () {
Navigator.pushNamed(
context,
AppRoutes.chatDetailed,
arguments: {"targetUser": m.favUsersList![index], "isNewChat": false},
).then(
(Object? value) {
m.clearSelections();
},
);
},
),
);
},
separatorBuilder: (BuildContext context, int index) => const Padding(
padding: EdgeInsets.only(
right: 10,
left: 70,
),
child: Divider(
color: Color(
0xFFE5E5E5,
),
),
),
)
: Column(
children: <Widget>[
Utils.getNoDataWidget(context).expanded,
],
);
}
},
),
);
}
}

@ -53,8 +53,8 @@ class _SuccessDialogState extends State<SuccessDialog> with TickerProviderStateM
repeat: false,
reverse: false,
controller: _controller,
frameRate: FrameRate(60.0),
onLoaded: (LottieComposition v) async {
print("calling_lottie " + v.seconds.toString());
await playSuccessSound();
_controller
..duration = v.duration

@ -13,6 +13,7 @@ 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/main.dart';
import 'package:mohem_flutter_app/models/offers_and_discounts/get_offers_list.dart';
import 'package:mohem_flutter_app/provider/dashboard_provider_model.dart';
import 'package:mohem_flutter_app/ui/landing/widget/app_drawer.dart';
@ -71,6 +72,7 @@ class _DashboardScreenState extends State<DashboardScreen> {
data.fetchLeaveTicketBalance(context, DateTime.now());
data.fetchMenuEntries();
data.getCategoryOffersListAPI(context);
data.fetchChatCounts();
_refreshController.refreshCompleted();
}
@ -256,7 +258,7 @@ class _DashboardScreenState extends State<DashboardScreen> {
margin: EdgeInsets.only(top: AppState().isArabic(context) ? 6 : 0),
width: 45,
height: 45,
padding: const EdgeInsets.only(left: 14, right: 14),
padding: const EdgeInsets.only(left: 10, right: 10),
decoration: BoxDecoration(
color: Color(0xff259EA4),
borderRadius: BorderRadius.only(
@ -268,7 +270,7 @@ class _DashboardScreenState extends State<DashboardScreen> {
).onPress(() {
showMyBottomSheet(
context,
callBackFunc: (){},
callBackFunc: () {},
child: MarkAttendanceWidget(model, isFromDashboard: true),
);
}),
@ -296,7 +298,7 @@ class _DashboardScreenState extends State<DashboardScreen> {
),
],
).paddingOnly(left: 21, right: 21, top: 7),
MarathonBanner().paddingAll(20),
const MarathonBanner().paddingAll(20),
ServicesWidget(),
// 8.height,
Container(
@ -469,10 +471,29 @@ class _DashboardScreenState extends State<DashboardScreen> {
label: LocaleKeys.itemsForSale.tr(),
),
BottomNavigationBarItem(
icon: SvgPicture.asset(
"assets/icons/chat/chat.svg",
color: currentIndex == 4 ? MyColors.grey3AColor : MyColors.grey98Color,
).paddingAll(4),
icon: Stack(
alignment: Alignment.centerLeft,
children: [
SvgPicture.asset(
"assets/icons/chat/chat.svg",
color: currentIndex == 4 ? MyColors.grey3AColor : MyColors.grey98Color,
).paddingAll(4),
Consumer<DashboardProviderModel>(
builder: (BuildContext cxt, DashboardProviderModel data, Widget? child) {
return Positioned(
right: 0,
top: 0,
child: Container(
padding: const EdgeInsets.only(left: 4, right: 4),
alignment: Alignment.center,
decoration: BoxDecoration(color: MyColors.redColor, borderRadius: BorderRadius.circular(17)),
child: data.chatUConvCounter.toString().toText10(color: Colors.white),
),
);
},
),
],
),
label: LocaleKeys.chat.tr(),
),
],
@ -492,7 +513,9 @@ class _DashboardScreenState extends State<DashboardScreen> {
} else if (index == 3) {
Navigator.pushNamed(context, AppRoutes.itemsForSale);
} else if (index == 4) {
Navigator.pushNamed(context, AppRoutes.chat);
Navigator.pushNamed(context, AppRoutes.chat).then((Object? value) {
data.fetchChatCounts();
});
}
},
),

@ -86,7 +86,7 @@ class _TodayAttendanceScreenState extends State<TodayAttendanceScreen2> {
child: CircularStepProgressBar(
totalSteps: 16 * 4,
currentStep: (model.progress * 100).toInt(),
selectedColor: MyColors.gradiantEndColor,
selectedColor: MyColors.gradiantStartColor,
unselectedColor: MyColors.grey70Color,
child: Center(
child: Padding(

@ -39,7 +39,7 @@ class ServicesWidget extends StatelessWidget {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
children: [
data.homeMenus![parentIndex].menuEntry.prompt!.toSectionHeading().paddingOnly(left: 21, right: 21),
SizedBox(
height: 105 + 26,
@ -69,12 +69,12 @@ class ServicesWidget extends StatelessWidget {
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
SvgPicture.asset(iconT[index]),
SvgPicture.asset(AppState().isArabic(context) ? getMenuIconAr(data.homeMenus![parentIndex].menuEntiesList[index].prompt!) : getMenuIconEn(data.homeMenus![parentIndex].menuEntiesList[index].prompt!)),
Row(
crossAxisAlignment: CrossAxisAlignment.end,
children: [
Expanded(
child: data.homeMenus![parentIndex].menuEntiesList[index].prompt!.toText10(isBold: true),
child: data.homeMenus![parentIndex].menuEntiesList[index].prompt!.toText11(isBold: true),
),
RotatedBox(quarterTurns: AppState().isArabic(context) ? 2 : 4, child: SvgPicture.asset("assets/images/arrow_next.svg").paddingOnly(bottom: 4)),
],
@ -102,6 +102,92 @@ class ServicesWidget extends StatelessWidget {
);
}
String getMenuIconAr(String name) {
String returnImage = "";
switch (name) {
case "الحضور الشهري":
returnImage = "assets/images/services_icons/monthly_attendance.svg";
break;
case "كشف الراتب":
returnImage = "assets/images/services_icons/payslips.svg";
break;
case "تغيير معلومات البنك":
returnImage = "assets/images/services_icons/change_bank_details.svg";
break;
case "طلب بدل السكن مقدما":
returnImage = "assets/images/services_icons/housing_allowance.svg";
break;
case "شهادات تعريف الموظف":
returnImage = "assets/images/services_icons/employee_certificates.svg";
break;
case "البيانات الشخصية":
returnImage = "assets/images/personal-info.svg";
break;
case "الحضور":
returnImage = "assets/images/services_icons/my_attendance.svg";
break;
case "طلبات أخرى":
returnImage = "assets/images/services_icons/other_requests.svg";
break;
case "الإجازات":
returnImage = "assets/images/services_icons/my_leaves.svg";
break;
case "طلب تذكرة":
returnImage = "assets/images/services_icons/ticket_bal.svg";
break;
case "قاعدة الاجازات":
returnImage = "assets/images/services_icons/vacation_rule.svg";
break;
default:
returnImage = "assets/images/monthly_attendance.svg";
break;
}
return returnImage;
}
String getMenuIconEn(String name) {
String returnImage = "";
switch (name) {
case "Monthly Attendance":
returnImage = "assets/images/services_icons/monthly_attendance.svg";
break;
case "Payslip":
returnImage = "assets/images/services_icons/payslips.svg";
break;
case "Change Bank Details":
returnImage = "assets/images/services_icons/change_bank_details.svg";
break;
case "Housing Advance":
returnImage = "assets/images/services_icons/housing_allowance.svg";
break;
case "Employee Certificate":
returnImage = "assets/images/services_icons/employee_certificates.svg";
break;
case "Personal Information":
returnImage = "assets/images/personal-info.svg";
break;
case "My Attendance":
returnImage = "assets/images/services_icons/my_attendance.svg";
break;
case "Other Requests":
returnImage = "assets/images/services_icons/other_requests.svg";
break;
case "My Leave":
returnImage = "assets/images/services_icons/my_leaves.svg";
break;
case "Ticket Request":
returnImage = "assets/images/services_icons/ticket_bal.svg";
break;
case "Vacation Rule":
returnImage = "assets/images/services_icons/vacation_rule.svg";
break;
default:
returnImage = "assets/images/monthly_attendance.svg";
break;
}
return returnImage;
}
void handleOnPress(context, GetMenuEntriesList menuEntry) {
var pro = Provider.of<DashboardProviderModel>(context, listen: false);
if (menuEntry.requestType == "MONTHLY_ATTENDANCE") {

@ -50,17 +50,25 @@ class _ForgotPasswordScreenState extends State<ForgotPasswordScreen> {
context,
1,
int.tryParse(_basicMemberInformation?.pMOBILENUMBER ?? ""),
(value) async {
(value,TextEditingController _pinPutController) async {
Utils.showLoading(context);
GenericResponseModel? genericResponseModel = await LoginApiClient().checkPublicActivationCode(value, employeeId.text);
if (genericResponseModel?.errorMessage != null) {
Utils.showToast(genericResponseModel?.errorMessage ?? "");
return;
}
Utils.hideLoading(context);
await Navigator.pushNamed(context, AppRoutes.newPassword, arguments: employeeId.text);
Navigator.pop(context);
Navigator.pop(context);
try{
GenericResponseModel? genericResponseModel = await LoginApiClient().checkPublicActivationCode(value, employeeId.text);
if (genericResponseModel?.errorMessage != null) {
Utils.showToast(genericResponseModel?.errorMessage ?? "");
return;
}
Utils.hideLoading(context);
await Navigator.pushNamed(context, AppRoutes.newPassword, arguments: employeeId.text);
Navigator.pop(context);
Navigator.pop(context);
}catch(ex){
print(ex);
_pinPutController.clear();
otpFieldClear.value = "";
Utils.hideLoading(context);
Utils.handleException(ex, context, null);
}
},
() => {
Navigator.pop(context),

@ -335,16 +335,16 @@ class _VerifyLastLoginScreenState extends State<VerifyLastLoginScreen> {
if (!isDirectLogin)
BasicMemberInformationModel? memberInformationModel =
await LoginApiClient().mohemmSendActivationCodeByOTPNotificationType(0, AppState().memberLoginList?.pMOBILENUMBER, sendVerificationFlat, AppState().getUserName);
if (isDirectLogin) performDirectApiCall(_title, _icon, _flag, "");
if (isDirectLogin) performDirectApiCall(_title, _icon, _flag, "", null);
if (!isDirectLogin) Utils.hideLoading(context);
if (!isDirectLogin)
OtpDialog(
context,
sendVerificationFlat,
int.tryParse(AppState().memberLoginList?.pMOBILENUMBER ?? ""),
(value) async {
(value, TextEditingController _pinPutController) async {
Utils.showLoading(context);
performDirectApiCall(_title, _icon, _flag, value);
performDirectApiCall(_title, _icon, _flag, value, _pinPutController);
},
() => {
Navigator.pop(context),
@ -359,7 +359,7 @@ class _VerifyLastLoginScreenState extends State<VerifyLastLoginScreen> {
}
}
Future<void> performDirectApiCall(String _title, String _icon, int _flag, String value, {bool isDirectLogin = false}) async {
Future<void> performDirectApiCall(String _title, String _icon, int _flag, String value, TextEditingController? _pinPutController, {bool isDirectLogin = false}) async {
try {
GenericResponseModel? genericResponseModel = await LoginApiClient().checkActivationCode(false, AppState().memberLoginList?.pMOBILENUMBER, value, AppState().getUserName);
GenericResponseModel? genericResponseModel1 = await LoginApiClient().insertMobileLoginInfoNEW(
@ -372,14 +372,18 @@ class _VerifyLastLoginScreenState extends State<VerifyLastLoginScreen> {
mobileLoginInfoListModel!.deviceToken!,
Platform.isAndroid ? "android" : "ios");
AppState().setMemberInformationListModel = genericResponseModel!.memberInformationList?.first;
if (genericResponseModel?.errorMessage != null) {
Utils.showToast(genericResponseModel?.errorMessage ?? "");
if (genericResponseModel.errorMessage != null) {
Utils.showToast(genericResponseModel.errorMessage ?? "");
// Navigator.pop(context);
}
Utils.hideLoading(context);
Navigator.pop(context);
Navigator.pushNamedAndRemoveUntil(context, AppRoutes.dashboard, (Route<dynamic> route) => false);
} catch (ex) {
if (_pinPutController != null) {
_pinPutController.clear();
otpFieldClear.value = "";
}
Utils.hideLoading(context);
Utils.handleException(ex, context, null);
}

@ -617,7 +617,7 @@ class _VerifyLoginScreenState extends State<VerifyLoginScreen> {
context,
sendVerificationFlat,
int.tryParse(AppState().memberLoginList?.pMOBILENUMBER ?? ""),
(value) async {
(value, TextEditingController _pinPutController) async {
Utils.showLoading(context);
try {
GenericResponseModel? genericResponseModel = await LoginApiClient().checkActivationCode(true, AppState().memberLoginList?.pMOBILENUMBER, value, AppState().getUserName);
@ -652,6 +652,8 @@ class _VerifyLoginScreenState extends State<VerifyLoginScreen> {
Navigator.pushNamedAndRemoveUntil(context, AppRoutes.dashboard, (Route<dynamic> route) => false);
} catch (ex) {
print(ex);
_pinPutController.clear();
otpFieldClear.value = "";
Utils.hideLoading(context);
Utils.handleException(ex, context, null);
}

@ -142,7 +142,7 @@ class MarathonBanner extends StatelessWidget {
bottom: 0,
child: RotatedBox(
quarterTurns: 4,
child: SvgPicture.asset("assets/images/arrow_next.svg", color: MyColors.darkDigitColor),
child: SvgPicture.asset("assets/images/arrow_next.svg", color: MyColors.whiteColor),
).paddingAll(15),
)
: Positioned(
@ -150,7 +150,7 @@ class MarathonBanner extends StatelessWidget {
left: 0,
child: RotatedBox(
quarterTurns: 2,
child: SvgPicture.asset("assets/images/arrow_next.svg", color: MyColors.darkDigitColor),
child: SvgPicture.asset("assets/images/arrow_next.svg", color: MyColors.whiteColor),
).paddingAll(15),
),
],

@ -68,7 +68,7 @@ class _RequestSubmitScreenState extends State<RequestSubmitScreen> {
}
void submitRequest() async {
// try {
try {
Utils.showLoading(context);
List<Map<String, dynamic>> list = [];
if (attachmentFiles.isNotEmpty) {
@ -90,28 +90,28 @@ class _RequestSubmitScreenState extends State<RequestSubmitScreen> {
if (params!.approvalFlag == 'phone_numbers') {
await ProfileApiClient().startPhoneApprovalProcess(
LocaleKeys.submit.tr(),
"SUBMIT",
comments.text,
params!.pItemId,
params!.transactionId,
);
} else if (params!.approvalFlag == 'address') {
await ProfileApiClient().startAddressApprovalProcess(
LocaleKeys.submit.tr(),
"SUBMIT",
comments.text,
params!.pItemId,
params!.transactionId,
);
} else if (params!.approvalFlag == 'family_member') {
await ProfileApiClient().getApproves(
LocaleKeys.submit.tr(),
"SUBMIT",
comments.text,
params!.transactionId!.toInt(),
params!.pItemId.toString(),
);
} else if (params!.approvalFlag == 'basicDetails') {
await ProfileApiClient().startBasicDetailsApprovalProcess(
LocaleKeys.submit.tr(),
"SUBMIT",
comments.text,
params!.pItemId,
params!.transactionId,
@ -124,15 +124,14 @@ class _RequestSubmitScreenState extends State<RequestSubmitScreen> {
);
} else if (params!.approvalFlag == 'eit') {
await MyAttendanceApiClient().startEitApprovalProcess(
LocaleKeys.submit.tr(),
"SUBMIT",
comments.text,
params!.pItemId,
params!.transactionId,
);
}else if (params!.approvalFlag == 'endEmployment') {
await TerminationDffApiClient().startTermApprovalProcess(
// "SUBMIT",
LocaleKeys.submit.tr(),
"SUBMIT",
comments.text,
params!.pItemId,
params!.transactionId,
@ -143,10 +142,10 @@ class _RequestSubmitScreenState extends State<RequestSubmitScreen> {
Utils.showToast(LocaleKeys.yourRequestHasBeenSubmittedForApprovals.tr(), longDuration: true);
Navigator.of(context).popUntil((route) => route.settings.name == AppRoutes.dashboard);
Navigator.pushNamed(context, AppRoutes.workList);
// } catch (ex) {
// Utils.hideLoading(context);
// Utils.handleException(ex, context, null);
// }
} catch (ex) {
Utils.hideLoading(context);
Utils.handleException(ex, context, null);
}
}
@override

@ -5,6 +5,7 @@ import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:mohem_flutter_app/api/leave_balance_api_client.dart';
import 'package:mohem_flutter_app/api/my_attendance_api_client.dart';
import 'package:mohem_flutter_app/app_state/app_state.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';
@ -43,22 +44,12 @@ class _DynamicInputScreenState extends State<DynamicInputScreen> {
void getTransactionsStructure() async {
try {
Utils.showLoading(context);
genericResponseModel = await MyAttendanceApiClient().getEitDffStructure(dynamicParams!.dynamicId);
genericResponseModel = await MyAttendanceApiClient().getEitDffStructure(dynamicParams!.dynamicId, dynamicParams!.selectedEmp);
dESCFLEXCONTEXTCODE = genericResponseModel!.pDESCFLEXCONTEXTCODE ?? "";
descFlexConTextTitle = genericResponseModel!.pDESCFLEXCONTEXTNAME ?? "";
getEitDffStructureList = genericResponseModel?.getEITDFFStructureList ?? [];
//getEitDffStructureList = getEitDffStructureList!.where((element) => element.dISPLAYFLAG != "N").toList();
if (dynamicParams!.collectionNotificationList != null && dynamicParams!.collectionNotificationList!.isNotEmpty) {
getEitDffStructureList!.forEach((element) {
dynamicParams!.collectionNotificationList!.forEach((element2) {
if (element.sEGMENTNAME == element2.segmentName) {
element.fieldAnswer = element2.varchar2Value;
element.eSERVICESDV ??= ESERVICESDV();
element.eSERVICESDV!.pIDCOLUMNNAME = element2.varchar2Value;
}
});
});
}
Utils.hideLoading(context);
setState(() {});
} catch (ex) {
@ -101,12 +92,7 @@ class _DynamicInputScreenState extends State<DynamicInputScreen> {
values.add(ValidateEitTransactionModel(dATEVALUE: null, nAME: "PEI_EXTRA_INFO_ID", nUMBERVALUE: -1, tRANSACTIONNUMBER: 1, vARCHAR2VALUE: null).toJson());
values.add(ValidateEitTransactionModel(dATEVALUE: null, nAME: "PEI_OBJECT_VERSION_NUMBER", nUMBERVALUE: 0, tRANSACTIONNUMBER: 1, vARCHAR2VALUE: null).toJson());
genericResponseModel = await MyAttendanceApiClient().validateEitTransaction(dESCFLEXCONTEXTCODE, dynamicParams!.dynamicId, values);
if (dynamicParams!.collectionNotificationList != null && dynamicParams!.collectionNotificationList!.isNotEmpty) {
Utils.hideLoading(context);
Navigator.pop(context, values);
return;
}
genericResponseModel = await MyAttendanceApiClient().validateEitTransaction(dESCFLEXCONTEXTCODE, dynamicParams!.dynamicId, values, empID:dynamicParams!.selectedEmp ??'');
SubmitEITTransactionList submitEITTransactionList = await MyAttendanceApiClient().submitEitTransaction(dESCFLEXCONTEXTCODE, dynamicParams!.dynamicId, values);
Utils.hideLoading(context);
await Navigator.pushNamed(context, AppRoutes.requestSubmitScreen,
@ -126,42 +112,19 @@ class _DynamicInputScreenState extends State<DynamicInputScreen> {
Future calGetValueSetValues(GetEITDFFStructureList structureList) async {
try {
Utils.showLoading(context);
List<Map<String, dynamic>> values = [];
String segmentId = structureList.cHILDSEGMENTSVS!;
if (dESCFLEXCONTEXTCODE.isEmpty) dESCFLEXCONTEXTCODE = structureList.dESCFLEXCONTEXTCODE!;
List<GetEITDFFStructureList> filteredList = getEitDffStructureList?.where((element) => element.cHILDSEGMENTSVSSplited!.contains(segmentId)).toList() ?? [];
if (filteredList.isEmpty && structureList.cHILDSEGMENTSVSSplited!.isNotEmpty) {
segmentId = structureList.cHILDSEGMENTSVSSplited![0];
filteredList = getEitDffStructureList?.where((element) => element.cHILDSEGMENTSVSSplited!.contains(segmentId)).toList() ?? [];
}
values = filteredList
List<Map<String, dynamic>> values = filteredList
.map((e) => GetSetValuesRequestModel(
sEGMENTNAME: e.sEGMENTNAME, vALUECOLUMNNAME: e.eSERVICESDV!.pVALUECOLUMNNAME, dESCRIPTION: "", iDCOLUMNNAME: e.eSERVICESDV!.pIDCOLUMNNAME, fLEXVALUESETNAME: e.fLEXVALUESETNAME)
.toJson())
.toList();
// if (parentValue.isNotEmpty && (structureList.vALIDATIONTYPE == "F")) {
// values = getDependenciesParams(parentValue);
// }
// if (structureList.pARENTSEGMENTSVSSplitedVS!.isNotEmpty) {
// structureList.pARENTSEGMENTSVSSplitedVS!.forEach((element2) {
// filteredList = getEitDffStructureList?.where((element) => element.sEGMENTNAME == element2.name).toList() ?? [];
// values = filteredList
// .map((e) => GetSetValuesRequestModel(
// sEGMENTNAME: e.sEGMENTNAME, vALUECOLUMNNAME: e.eSERVICESDV!.pVALUECOLUMNNAME, dESCRIPTION: "", iDCOLUMNNAME: e.eSERVICESDV!.pIDCOLUMNNAME, fLEXVALUESETNAME: e.fLEXVALUESETNAME)
// .toJson())
// .toList();
// });
// List<GetEITDFFStructureList> filteredList2 = getEitDffStructureList?.where((element) => element.fLEXVALUESETNAME == structureList.fLEXVALUESETNAME).toList() ?? [];
// }
List<ESERVICESVS> eServicesResponseModel = await MyAttendanceApiClient().getValueSetValues(segmentId, structureList.dESCFLEXCONTEXTCODE!, structureList.dESCFLEXNAME!, values);
List<ESERVICESVS> eServicesResponseModel = await MyAttendanceApiClient().getValueSetValues(segmentId, structureList.dESCFLEXCONTEXTCODE!, structureList.dESCFLEXNAME!,
values, empID:dynamicParams!.selectedEmp ??'', parentValue: structureList.eSERVICESDV!.pVALUECOLUMNNAME );
List<GetEITDFFStructureList> abc = genericResponseModel?.getEITDFFStructureList ?? [];
getEitDffStructureList = abc;
int index = getEitDffStructureList!.indexWhere((element) => element.sEGMENTNAME == segmentId);
int index = getEitDffStructureList!.indexWhere((element) => element.sEGMENTNAME == structureList.cHILDSEGMENTSVS);
getEitDffStructureList![index].eSERVICESVS!.clear();
if (eServicesResponseModel.isNotEmpty) getEitDffStructureList![index].eSERVICESVS!.addAll(eServicesResponseModel);
// getEitDffStructureList = genericResponseModel?.getEITDFFStructureList ?? [];
@ -194,26 +157,7 @@ class _DynamicInputScreenState extends State<DynamicInputScreen> {
List<Map<String, dynamic>> getSetList = getDefaultValuesIonicLogic(parent);
if (getSetList.isNotEmpty) {
ESERVICESDV defaultValue = await MyAttendanceApiClient().getDefaultValue(segmentId, structureList.dESCFLEXCONTEXTCODE!, structureList.dESCFLEXNAME!, getSetList);
int index = getEitDffStructureList!.indexWhere((element) => element.sEGMENTNAME == segmentId);
getEitDffStructureList![index].eSERVICESDV = defaultValue;
GetEITDFFStructureList defaultValueCheck = getEitDffStructureList!.where((GetEITDFFStructureList element) => element.sEGMENTNAME == segmentId).toList().first;
if (defaultValueCheck.cHILDSEGMENTSDVSplited!.isNotEmpty && defaultValueCheck.rEADONLY == 'Y') {
getDefaultValues(defaultValueCheck);
Utils.hideLoading(context);
// GetEITDFFStructureList? parent = getEitDffStructureList!.firstWhere((element) => element.sEGMENTNAME == segmentId);
// List<Map<String, dynamic>> getSetList = getDefaultValuesIonicLogic(parent);
// ESERVICESDV defaultValue = await MyAttendanceApiClient().getDefaultValue(segmentId, defaultValueCheck.dESCFLEXCONTEXTCODE!, defaultValueCheck.dESCFLEXNAME!, getSetList);
// int index = getEitDffStructureList!.indexWhere((element) => element.sEGMENTNAME == segmentId);
// getEitDffStructureList![index].eSERVICESDV = defaultValue;
} else if (defaultValueCheck.cHILDSEGMENTSVSSplited!.isNotEmpty && defaultValueCheck.rEADONLY == 'Y') {
calGetValueSetValues(defaultValueCheck);
Utils.hideLoading(context);
}
} else if (values.isNotEmpty) {
ESERVICESDV defaultValue = await MyAttendanceApiClient().getDefaultValue(segmentId, structureList.dESCFLEXCONTEXTCODE!, structureList.dESCFLEXNAME!, values);
ESERVICESDV defaultValue = await MyAttendanceApiClient().getDefaultValue(segmentId, structureList.dESCFLEXCONTEXTCODE!, structureList.dESCFLEXNAME!, getSetList, dynamicParams!.selectedEmp);
int index = getEitDffStructureList!.indexWhere((element) => element.sEGMENTNAME == segmentId);
getEitDffStructureList![index].eSERVICESDV = defaultValue;
}
@ -238,79 +182,79 @@ class _DynamicInputScreenState extends State<DynamicInputScreen> {
// }
List<Map<String, dynamic>> getDefaultValuesIonicLogic(GetEITDFFStructureList structureElement) {
//try {
List<PARENTSEGMENTSVSSplitedVS> parentValue = structureElement.pARENTSEGMENTSVSSplitedVS ?? [];
List<PARENTSEGMENTSDVSplited> parentsList = structureElement.pARENTSEGMENTSDVSplited ?? [];
List<Map<String, dynamic>> dependenciesList = [];
String? parentVal;
bool isStandardDate = false;
bool isStandardTimeDate = false;
bool isStandardTime = false;
bool isHidden = false;
bool isReadOnlyList = false;
bool isSelectElement = false;
// isStandardDate = this.isStandardDate(obj);
// isStandardTimeDate = this.isStandardDateTime(obj);
// isStandardTime = this.isStandardTime(obj);
if (structureElement.dISPLAYFLAG == "N") isHidden = true;
if (structureElement.vALIDATIONTYPE != "N" && structureElement.rEADONLY == "Y") {
isReadOnlyList = true;
}
if (structureElement.vALIDATIONTYPE != "N" && structureElement.rEADONLY == "N") {
isSelectElement = true;
}
try {
List<PARENTSEGMENTSVSSplitedVS> parentValue = structureElement.pARENTSEGMENTSVSSplitedVS ?? [];
List<PARENTSEGMENTSDVSplited> parentsList = structureElement.pARENTSEGMENTSDVSplited ?? [];
List<Map<String, dynamic>> dependenciesList = [];
String? parentVal;
bool isStandardDate = false;
bool isStandardTimeDate = false;
bool isStandardTime = false;
bool isHidden = false;
bool isReadOnlyList = false;
bool isSelectElement = false;
// isStandardDate = this.isStandardDate(obj);
// isStandardTimeDate = this.isStandardDateTime(obj);
// isStandardTime = this.isStandardTime(obj);
if (structureElement.dISPLAYFLAG == "N") isHidden = true;
if (structureElement.vALIDATIONTYPE != "N" && structureElement.rEADONLY == "Y") {
isReadOnlyList = true;
}
if (structureElement.vALIDATIONTYPE != "N" && structureElement.rEADONLY == "N") {
isSelectElement = true;
}
if (parentValue.isNotEmpty && (structureElement.vALIDATIONTYPE == "D" || structureElement.vALIDATIONTYPE == "Y")) {
List parValue = getDependenciesParams(parentValue);
if (parentValue.isNotEmpty && (structureElement.vALIDATIONTYPE == "D" || structureElement.vALIDATIONTYPE == "Y")) {
List parValue = getDependenciesParams(parentValue);
if (parValue.isNotEmpty) {
parentVal = parValue.first.ID_COLUMN_NAME;
}
if (parValue.isNotEmpty) {
parentVal = parValue.first.ID_COLUMN_NAME;
}
if (parentVal == null) {
return [];
if (parentVal == null) {
return [];
}
}
}
if (parentsList.isNotEmpty) {
if (parentValue.isNotEmpty) {
parentsList = parentsList + parentValue.map((e) => PARENTSEGMENTSDVSplited.fromJson(e.toJson())).toList();
// parentsList.addAll(parentValue.map((e) => PARENTSEGMENTSDVSplited.fromJson(e.toJson())));
// parentsList.concat(parentValue);
if (parentsList.isNotEmpty) {
if (parentValue.isNotEmpty) {
parentsList = parentsList + parentValue.map((e) => PARENTSEGMENTSDVSplited.fromJson(e.toJson())).toList();
// parentsList.addAll(parentValue.map((e) => PARENTSEGMENTSDVSplited.fromJson(e.toJson())));
// parentsList.concat(parentValue);
}
dependenciesList = getDependenciesParams(parentsList);
}
dependenciesList = getDependenciesParams(parentsList);
return dependenciesList;
// for (int i = 0; i < (structureList.cHILDSEGMENTSDVSplited?.length ?? 0); i++) {
// String segmentId = structureList.cHILDSEGMENTSDVSplited![i];
// print("segmentId:$segmentId");
// print("segmentName:${structureList.sEGMENTNAME}");
// GetEITDFFStructureList? parent = getEitDffStructureList!.firstWhere((element) => element.sEGMENTNAME == segmentId);
// List<PARENTSEGMENTSDVSplited> parentDvRequired = parent.pARENTSEGMENTSDVSplited ?? [];
// List<PARENTSEGMENTSVSSplitedVS> parentVsRequired = parent.pARENTSEGMENTSVSSplitedVS ?? [];
//
// List<GetEITDFFStructureList> filteredList =
// getEitDffStructureList!.where((outerElement) => parentDvRequired.any((element) => outerElement.sEGMENTNAME == element.name && element.isRequired == "REQUIRED")).toList();
//
// List<Map<String, dynamic>> values = filteredList
// .map((e) => GetSetValuesRequestModel(
// sEGMENTNAME: e.sEGMENTNAME, vALUECOLUMNNAME: e.eSERVICESDV!.pVALUECOLUMNNAME, dESCRIPTION: "", iDCOLUMNNAME: e.eSERVICESDV!.pIDCOLUMNNAME, fLEXVALUESETNAME: e.fLEXVALUESETNAME)
// .toJson())
// .toList();
// print("values:$values");
//
// ESERVICESDV defaultValue = await MyAttendanceApiClient().getDefaultValue(segmentId, structureList.dESCFLEXCONTEXTCODE!, structureList.dESCFLEXNAME!, values);
// int index = getEitDffStructureList!.indexWhere((element) => element.sEGMENTNAME == segmentId);
// getEitDffStructureList![index].eSERVICESDV = defaultValue;
// }
// Utils.hideLoading(context);
// setState(() {});
} catch (ex) {
Utils.hideLoading(context);
Utils.handleException(ex, context, null);
return [];
}
return dependenciesList;
// for (int i = 0; i < (structureList.cHILDSEGMENTSDVSplited?.length ?? 0); i++) {
// String segmentId = structureList.cHILDSEGMENTSDVSplited![i];
// print("segmentId:$segmentId");
// print("segmentName:${structureList.sEGMENTNAME}");
// GetEITDFFStructureList? parent = getEitDffStructureList!.firstWhere((element) => element.sEGMENTNAME == segmentId);
// List<PARENTSEGMENTSDVSplited> parentDvRequired = parent.pARENTSEGMENTSDVSplited ?? [];
// List<PARENTSEGMENTSVSSplitedVS> parentVsRequired = parent.pARENTSEGMENTSVSSplitedVS ?? [];
//
// List<GetEITDFFStructureList> filteredList =
// getEitDffStructureList!.where((outerElement) => parentDvRequired.any((element) => outerElement.sEGMENTNAME == element.name && element.isRequired == "REQUIRED")).toList();
//
// List<Map<String, dynamic>> values = filteredList
// .map((e) => GetSetValuesRequestModel(
// sEGMENTNAME: e.sEGMENTNAME, vALUECOLUMNNAME: e.eSERVICESDV!.pVALUECOLUMNNAME, dESCRIPTION: "", iDCOLUMNNAME: e.eSERVICESDV!.pIDCOLUMNNAME, fLEXVALUESETNAME: e.fLEXVALUESETNAME)
// .toJson())
// .toList();
// print("values:$values");
//
// ESERVICESDV defaultValue = await MyAttendanceApiClient().getDefaultValue(segmentId, structureList.dESCFLEXCONTEXTCODE!, structureList.dESCFLEXNAME!, values);
// int index = getEitDffStructureList!.indexWhere((element) => element.sEGMENTNAME == segmentId);
// getEitDffStructureList![index].eSERVICESDV = defaultValue;
// }
// Utils.hideLoading(context);
// setState(() {});
// } catch (ex) {
// Utils.hideLoading(context);
// Utils.handleException(ex, context, null);
// return [];
// }
}
List<Map<String, dynamic>> getDependenciesParams(parentsList) {
@ -318,7 +262,7 @@ class _DynamicInputScreenState extends State<DynamicInputScreen> {
for (int i = 0; i < parentsList.length; i++) {
for (int j = 0; j < (getEitDffStructureList?.length ?? 0); j++) {
if (getEitDffStructureList![j].sEGMENTNAME == parentsList[i]?.name) {
if (getEitDffStructureList![j].sEGMENTNAME == parentsList[i].name) {
if (getEitDffStructureList![j].dISPLAYFLAG != "N") {
if (getEitDffStructureList![j].vALIDATIONTYPE == "N") {
String? idColName;
@ -450,6 +394,9 @@ class _DynamicInputScreenState extends State<DynamicInputScreen> {
Widget build(BuildContext context) {
if (dynamicParams == null) {
dynamicParams = ModalRoute.of(context)!.settings.arguments as DynamicListViewParams;
if(dynamicParams!.selectedEmp.isNotEmpty){
AppState().postParamsJson['P_SELECTED_EMPLOYEE_NUMBER'] = dynamicParams!.selectedEmp;
}
getTransactionsStructure();
}
return Scaffold(
@ -513,11 +460,6 @@ class _DynamicInputScreenState extends State<DynamicInputScreen> {
model.eSERVICESDV ??= ESERVICESDV();
model.eSERVICESDV!.pIDCOLUMNNAME = text;
},
onTap: () async {
if (model.cHILDSEGMENTSDVSplited?.isNotEmpty ?? false) {
await getDefaultValues(model);
}
},
).paddingOnly(bottom: 12);
} else if (model.fORMATTYPE == "X") {
String displayText = model.eSERVICESDV?.pIDCOLUMNNAME ?? (getEitDffStructureList![index].fieldAnswer ?? "");

@ -18,9 +18,11 @@ class DynamicListViewParams {
String requestID;
String colsURL;
bool isUpdate;
List<CollectionNotificationEit>? collectionNotificationList;
final String selectedEmp;
DynamicListViewParams(this.title, this.dynamicId, {this.uRL = 'GET_EIT_DFF_STRUCTURE', this.requestID = '', this.colsURL = '', this.isUpdate = false, this.collectionNotificationList});
DynamicListViewParams(this.title, this.dynamicId, {this.selectedEmp ='', this.uRL = 'GET_EIT_DFF_STRUCTURE', this.requestID = '', this.colsURL = '', this.isUpdate = false, this.collectionNotificationList});
}
class DynamicListViewScreen extends StatefulWidget {
@ -35,6 +37,7 @@ class DynamicListViewScreen extends StatefulWidget {
class _DynamicListViewScreenState extends State<DynamicListViewScreen> {
List<GetEITTransactionList>? getEITTransactionList;
DynamicListViewParams? dynamicParams;
// String? empId;
@override
void initState() {
@ -44,7 +47,7 @@ class _DynamicListViewScreenState extends State<DynamicListViewScreen> {
void getTransactions() async {
try {
Utils.showLoading(context);
getEITTransactionList = await MyAttendanceApiClient().getEitTransaction(dynamicParams!.dynamicId);
getEITTransactionList = await MyAttendanceApiClient().getEitTransaction(dynamicParams!.dynamicId, dynamicParams!.selectedEmp);
getEITTransactionList?.forEach((element) {
element.collectionTransaction = element.collectionTransaction?.where((elemen) => elemen.dISPLAYFLAG == "Y").toList() ?? [];
});

@ -8,6 +8,7 @@ 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/models/dashboard/menu_entries.dart';
import 'package:mohem_flutter_app/models/my_team/get_employee_subordinates_list.dart';
import 'package:mohem_flutter_app/provider/dashboard_provider_model.dart';
import 'package:mohem_flutter_app/ui/my_attendance/dynamic_screens/dynamic_listview_screen.dart';
import 'package:mohem_flutter_app/widgets/app_bar_widget.dart';
@ -16,8 +17,9 @@ import 'package:provider/provider.dart';
class ServicesMenuListScreenParams {
final String title;
final List<GetMenuEntriesList> list;
ServicesMenuListScreenParams(this.title, this.list);
final String selectedEmp;
GetEmployeeSubordinatesList? getEmployeeSubordinates;
ServicesMenuListScreenParams(this.title, this.list, {this.selectedEmp =''});
}
class ServicesMenuListScreen extends StatelessWidget {
@ -56,7 +58,7 @@ class ServicesMenuListScreen extends StatelessWidget {
return;
}
if (servicesMenuData.list[index].requestType == "EIT") {
Navigator.pushNamed(context, AppRoutes.dynamicScreen, arguments: DynamicListViewParams(servicesMenuData.list[index].prompt!, servicesMenuData.list[index].functionName!));
Navigator.pushNamed(context, AppRoutes.dynamicScreen, arguments: DynamicListViewParams(servicesMenuData.list[index].prompt!, servicesMenuData.list[index].functionName!, selectedEmp: servicesMenuData.selectedEmp));
} else {
if (servicesMenuData.list[index].requestType == "TERMINATION") {
Navigator.pushNamed(context, AppRoutes.endEmploymentScreen,

@ -65,13 +65,14 @@ class _CreateRequestState extends State<CreateRequest> {
return menus;
}
void handleOnPress(context, Menus menu) {
void handleOnPress(context, Menus menu) {
if (menu.menuEntry.menuEntryType == "FUNCTION") {
if (menu.menuEntry.requestType == "EIT") {
Navigator.pushNamed(context, AppRoutes.dynamicScreen, arguments: DynamicListViewParams(menu.menuEntry.prompt!, menu.menuEntry.functionName!));
} else {}
} else {
Navigator.pushNamed(context, AppRoutes.servicesMenuListScreen, arguments: ServicesMenuListScreenParams(menu.menuEntry.prompt!, menu.menuEntiesList));
Navigator.pushNamed(context, AppRoutes.servicesMenuListScreen, arguments: ServicesMenuListScreenParams(menu.menuEntry.prompt!, menu.menuEntiesList, selectedEmp: getEmployeeSubordinates?.eMPLOYEENUMBER??''));
}
return;
}

@ -14,7 +14,8 @@ import 'package:mohem_flutter_app/widgets/app_bar_widget.dart';
import 'package:url_launcher/url_launcher.dart';
class TeamMembers extends StatefulWidget {
const TeamMembers({Key? key}) : super(key: key);
final String? selectedEmp;
const TeamMembers({this.selectedEmp, Key? key}) : super(key: key);
@override
_TeamMembersState createState() => _TeamMembersState();
@ -25,6 +26,7 @@ class _TeamMembersState extends State<TeamMembers> {
String searchEmpName ="";
String searchEmpNo = "";
String? empId;
List<GetEmployeeSubordinatesList> getEmployeeSubordinatesList = [];
GetEmployeeSubordinatesList? getEmployeeSubordinates;
@ -37,7 +39,7 @@ class _TeamMembersState extends State<TeamMembers> {
try {
Utils.showLoading(context);
getEmployeeSubordinatesList = await MyTeamApiClient().getEmployeeSubordinates(searchEmpEmail.toString(), searchEmpName.toString(), searchEmpNo.toString());
getEmployeeSubordinatesList = await MyTeamApiClient().employeeSubordinates(searchEmpEmail.toString(), searchEmpName.toString(), searchEmpNo.toString(),getEmployeeSubordinates?.eMPLOYEENUMBER);
// getEmployeeSubordinatesList = await MyTeamApiClient().employeeSubordinates(searchEmpEmail.toString(), searchEmpName.toString(), searchEmpNo.toString(),getEmployeeSubordinates?.eMPLOYEENUMBER);
Utils.hideLoading(context);
setState(() {});
} catch (ex) {

@ -439,7 +439,7 @@ class _ViewAttendanceState extends State<ViewAttendance> {
expand: false,
builder: (_, controller) {
dynamic dmyString = getScheduleShiftsDetailsList!.sCHEDULEDATE;
DateTime dateTime1 = DateFormat("MM/dd/yyyy hh:mm:ss a").parse(dmyString);
DateTime dateTime1 = DateFormat("MM/dd/yyyy hh:mm:ss").parse(dmyString);
return Column(
children: [
Container(

@ -383,7 +383,7 @@ class _AddUpdateFamilyMemberState extends State<AddUpdateFamilyMember> {
),
);
} else {
DateTime? picked = await showDatePicker(context: context, initialDate: selectedDate, initialEntryMode: DatePickerEntryMode.calendarOnly, firstDate: DateTime(2015, 8), lastDate: DateTime(2101));
DateTime? picked = await showDatePicker(context: context, initialDate: selectedDate, initialEntryMode: DatePickerEntryMode.calendarOnly, firstDate: DateTime(1920, 1), lastDate: DateTime.now());
if (picked != null && picked != selectedDate) {
time = picked;
}

@ -80,11 +80,23 @@ class _DynamicInputScreenState extends State<DynamicInputScreenProfile> {
}
});
} else {
getBasicDetDffStructureList?.forEach((element) {
element.userBasicDetail = new GetEmployeeBasicDetailsList();
// getBasicDetDffStructureList?.forEach((element) {
// element.userBasicDetail = new GetEmployeeBasicDetailsList();
// });
// getBasicDetColsStructureList?.forEach((element) {
// element.userBasicDetail = GetEmployeeBasicDetailsList();
// });
getBasicDetDffStructureList?.forEach((GetBasicDetDffStructureList element) {
element.userBasicDetail =
dynamicParams!.getEmployeeBasicDetailsList!.singleWhere((GetEmployeeBasicDetailsList userDetail) => userDetail.aPPLICATIONCOLUMNNAME == element.aPPLICATIONCOLUMNNAME);
});
getBasicDetColsStructureList?.forEach((element) {
element.userBasicDetail = GetEmployeeBasicDetailsList();
getBasicDetColsStructureList?.forEach((GetBasicDetColsStructureList element) {
element.userBasicDetail =
dynamicParams!.getEmployeeBasicDetailsList!.singleWhere((GetEmployeeBasicDetailsList userDetail) => userDetail.aPPLICATIONCOLUMNNAME == element.aPPLICATIONCOLUMNNAME);
if (element.objectValuesList != null) {
ObjectValuesList dropDownListValue = element.objectValuesList!.singleWhere((ObjectValuesList dropdown) => dropdown.cODE == element.userBasicDetail!.vARCHAR2VALUE);
element.userBasicDetail!.sEGMENTVALUEDSP = dropDownListValue.mEANING;
}
});
}
@ -369,7 +381,7 @@ class _DynamicInputScreenState extends State<DynamicInputScreenProfile> {
//values.add(ValidateEitTransactionModel(dATEVALUE: null, nAME: "PEI_OBJECT_VERSION_NUMBER", nUMBERVALUE: 0, tRANSACTIONNUMBER: 1, vARCHAR2VALUE: null).toJson());
List<Map<String, dynamic>> valuesCols = getBasicDetColsStructureList!.map((e) {
if (e.dATATYPE == 'NUMBER') {
numberValue = e.userBasicDetail!.nUMBERVALUE!;
numberValue = e.userBasicDetail!.nUMBERVALUE ?? 0;
}
return ValidateEitTransactionModel(
dATEVALUE: e.userBasicDetail!.dATEVALUE ?? "", nAME: e.aPPLICATIONCOLUMNNAME, nUMBERVALUE: numberValue, tRANSACTIONNUMBER: 1, vARCHAR2VALUE: e.userBasicDetail!.vARCHAR2VALUE ?? "")

@ -17,7 +17,8 @@ class DynamicListViewParams {
String dynamicId;
String uRL;
String requestID;
DynamicListViewParams(this.title, this.dynamicId, {this.uRL = 'GET_EIT_DFF_STRUCTURE', this.requestID = ''});
final String selectedEmp;
DynamicListViewParams(this.title, this.dynamicId, {this.selectedEmp ='', this.uRL = 'GET_EIT_DFF_STRUCTURE', this.requestID = ''});
}
class DynamicListViewScreen extends StatefulWidget {
@ -38,9 +39,9 @@ class _DynamicListViewScreenState extends State<DynamicListViewScreen> {
}
void getTransactions() async {
try {
try {
Utils.showLoading(context);
getEITTransactionList = await MyAttendanceApiClient().getEitTransaction(dynamicParams!.dynamicId);
getEITTransactionList = await MyAttendanceApiClient().getEitTransaction(dynamicParams!.dynamicId, dynamicParams!.selectedEmp);
Utils.hideLoading(context);
setState(() {});
} catch (ex) {

@ -128,7 +128,8 @@ class _FamilyMembersState extends State<FamilyMembers> {
),
DefaultButton(LocaleKeys.addNewFamilyMember.tr(),
menuEntries.updateButton == 'Y'
? () async {
?
() async {
Navigator.pushNamed(context, AppRoutes.addUpdateFamilyMember, arguments: {"relationID": relationId, "flag": 1, "actionType": "ADD"});
// ProfileScreen();
} : null).insideContainer,

@ -25,8 +25,9 @@ class AddItemDetailsFragment extends StatefulWidget {
final Function changePageViewIndex;
final GetSaleCategoriesList selectedSaleCategory;
static late ItemReviewModel itemReviewModel;
static late bool isUpdate;
const AddItemDetailsFragment({Key? key, required this.changePageViewIndex, required this.selectedSaleCategory}) : super(key: key);
AddItemDetailsFragment({Key? key, required this.changePageViewIndex, required this.selectedSaleCategory}) : super(key: key);
@override
State<AddItemDetailsFragment> createState() => _AddItemDetailsFragmentState();
@ -246,6 +247,7 @@ class _AddItemDetailsFragmentState extends State<AddItemDetailsFragment> {
String details = await Utils.getStringFromPrefs(SharedPrefsConsts.editItemForSale);
if(details.isNotEmpty) {
var body = json.decode(details);
AddItemDetailsFragment.isUpdate = true;
GetRegionsList selectedRegionAd = GetRegionsList();
@ -268,6 +270,8 @@ class _AddItemDetailsFragmentState extends State<AddItemDetailsFragment> {
AddItemDetailsFragment.itemReviewModel = itemReviewModel;
SelectCategoryFragment.selectedSaleCategory = selectedSaleCategoryAd;
} else {
AddItemDetailsFragment.isUpdate = false;
}
}

@ -26,11 +26,13 @@ class ItemReviewFragment extends StatefulWidget {
class _ItemReviewFragmentState extends State<ItemReviewFragment> {
ItemReviewModel? itemReviewModel;
late bool isUpdate;
@override
void initState() {
itemReviewModel = AddItemDetailsFragment.itemReviewModel;
itemReviewModel!.selectedSaleCategory = SelectCategoryFragment.selectedSaleCategory;
isUpdate = AddItemDetailsFragment.isUpdate;
super.initState();
}

@ -76,9 +76,7 @@ class _MyRequestsState extends State<MyRequests> {
}),
),
12.height,
Expanded(
// todo list don't have data, need to confirm later , because have issues, need fixes
getCCPTransactionsList.isNotEmpty ? Expanded(
child: ListView.separated(
physics: const BouncingScrollPhysics(),
shrinkWrap: true,
@ -141,7 +139,7 @@ class _MyRequestsState extends State<MyRequests> {
},
separatorBuilder: (BuildContext context, int index) => 12.height,
itemCount: getCCPTransactionsList.length),
),
) : Container(),
],
).expanded,
1.divider,

@ -176,8 +176,8 @@ class _OffersAndDiscountsDetailsState extends State<OffersAndDiscountsDetails> {
// // launchUrl(Uri.parse(url!));
// // }
// ),
getOffersList.description!.toText12(maxLine: 2, color: const Color(0xff535353)),
16.height,
// getOffersList.description!.toText12(maxLine: 2, color: const Color(0xff535353)),
// 16.height,
getOffersList.discount!.toText14(isBold: true, maxlines: 1),
8.height,
Row(

@ -173,7 +173,7 @@ class _OffersAndDiscountsHomeState extends State<OffersAndDiscountsHome> {
tag: "ItemImage" + getOffersList.rowID!,
transitionOnUserGestures: true,
child: AspectRatio(
aspectRatio: 148 / 127,
aspectRatio: 118 / 127,
child: ClipRRect(
borderRadius: BorderRadius.circular(6),
child: Image.network(
@ -192,10 +192,10 @@ class _OffersAndDiscountsHomeState extends State<OffersAndDiscountsHome> {
// // launchUrl(Uri.parse(url!));
// // }
// ),
getOffersList.description!.toText12(maxLine: 2, color: const Color(0xff535353)),
// getOffersList.description!.toText12(maxLine: 2, color: const Color(0xff535353)),
// 8.height,
getOffersList.discount!.toText14(isBold: true, maxlines: 1),
10.height,
20.height,
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [checkDate(getOffersList.endDate!), SvgPicture.asset("assets/images/arrow_next.svg").paddingOnly(bottom: 4)],
@ -211,7 +211,7 @@ class _OffersAndDiscountsHomeState extends State<OffersAndDiscountsHome> {
if (enteredKeyword.isEmpty) {
results = getOffersList;
} else {
if(AppState().isArabic(context)) {
if (AppState().isArabic(context)) {
results = getOffersList.where((offer) => offer.titleAR!.toLowerCase().contains(enteredKeyword.toLowerCase())).toList();
} else {
results = getOffersList.where((offer) => offer.title!.toLowerCase().contains(enteredKeyword.toLowerCase())).toList();

@ -102,21 +102,39 @@ class _ItemHistoryScreenState extends State<ItemHistoryScreen> {
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
ItemDetailView(LocaleKeys.requestNumber.tr(), moItemHistoryList[index].rEQUESTNUMBER ?? ""),
ItemDetailView(LocaleKeys.uom.tr(), moItemHistoryList[index].uNITOFMEASURE ?? ""),
ItemDetailView(LocaleKeys.quantity.tr(), moItemHistoryList[index].qUANTITY?.toString() ?? ""),
ItemDetailView(LocaleKeys.dateRequired.tr(), moItemHistoryList[index].dATEREQUIRED ?? ""),
ItemDetailView(LocaleKeys.lineStatus.tr(), moItemHistoryList[index].lINESTATUSDIS ?? ""),
ItemDetailView(LocaleKeys.statusDate.tr(), moItemHistoryList[index].sTATUSDATE ?? ""),
ItemDetailView(LocaleKeys.transactionType.tr(), moItemHistoryList[index].tRANSACTIONTYPENAME ?? ""),
ItemDetailView(LocaleKeys.organization.tr(), moItemHistoryList[index].oRGANIZATIONNAME ?? ""),
ItemDetailView(LocaleKeys.operatingCode.tr(), moItemHistoryList[index].oRGANIZATIONCODE ?? ""),
ItemDetailView(LocaleKeys.operatingUnit.tr(), moItemHistoryList[index].oPERATINGUNITNAME ?? ""),
ItemDetailView(LocaleKeys.fromSubInventory.tr(), moItemHistoryList[index].fROMSUBINVENTORYCODE ?? ""),
ItemDetailView(LocaleKeys.fromLocator.tr(), moItemHistoryList[index].fROMLOCATOR ?? ""),
ItemDetailView(LocaleKeys.toSubInventory.tr(), moItemHistoryList[index].tOSUBINVENTORYCODE ?? ""),
ItemDetailView(LocaleKeys.toLocator.tr(), moItemHistoryList[index].tOLOCATOR ?? ""),
ItemDetailView(LocaleKeys.shipToLocation.tr(), moItemHistoryList[index].sHIPTOLOCATION ?? ""),
ItemDetailGrid(
ItemDetailViewCol(LocaleKeys.requestNumber.tr(), moItemHistoryList[index].rEQUESTNUMBER ?? ""),
ItemDetailViewCol(LocaleKeys.uom.tr(), moItemHistoryList[index].uNITOFMEASURE ?? ""),
),
ItemDetailGrid(
ItemDetailViewCol(LocaleKeys.quantity.tr(), moItemHistoryList[index].qUANTITY?.toString() ?? ""),
ItemDetailViewCol(LocaleKeys.dateRequired.tr(), moItemHistoryList[index].dATEREQUIRED ?? ""),
),
ItemDetailGrid(
ItemDetailViewCol(LocaleKeys.lineStatus.tr(), moItemHistoryList[index].lINESTATUSDIS ?? ""),
ItemDetailViewCol(LocaleKeys.statusDate.tr(), moItemHistoryList[index].sTATUSDATE ?? ""),
),
ItemDetailGrid(
ItemDetailViewCol(LocaleKeys.transactionType.tr(), moItemHistoryList[index].tRANSACTIONTYPENAME ?? ""),
ItemDetailViewCol(LocaleKeys.organization.tr(), moItemHistoryList[index].oRGANIZATIONNAME ?? ""),
),
ItemDetailGrid(
ItemDetailViewCol(LocaleKeys.operatingCode.tr(), moItemHistoryList[index].oRGANIZATIONCODE ?? ""),
ItemDetailViewCol(LocaleKeys.operatingUnit.tr(), moItemHistoryList[index].oPERATINGUNITNAME ?? ""),
),
ItemDetailGrid(
ItemDetailViewCol(LocaleKeys.fromSubInventory.tr(), moItemHistoryList[index].fROMSUBINVENTORYCODE ?? ""),
ItemDetailViewCol(LocaleKeys.fromLocator.tr(), moItemHistoryList[index].fROMLOCATOR ?? ""),
),
ItemDetailGrid(
ItemDetailViewCol(LocaleKeys.toSubInventory.tr(), moItemHistoryList[index].tOSUBINVENTORYCODE ?? ""),
ItemDetailViewCol(LocaleKeys.toLocator.tr(), moItemHistoryList[index].tOLOCATOR ?? ""),
),
ItemDetailGrid(
ItemDetailViewCol(LocaleKeys.shipToLocation.tr(), moItemHistoryList[index].sHIPTOLOCATION ?? ""),
Container(),
isItLast: true,
),
],
).objectContainerView(),
separatorBuilder: (cxt, index) => 12.height,
@ -131,21 +149,39 @@ class _ItemHistoryScreenState extends State<ItemHistoryScreen> {
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
ItemDetailView(LocaleKeys.operatingUnit.tr(), poItemHistoryList[index].oUNAME ?? ""),
ItemDetailView(LocaleKeys.poNumber.tr(), poItemHistoryList[index].pONUMBER ?? ""),
ItemDetailView(LocaleKeys.revision.tr(), poItemHistoryList[index].rEVISIONNUM?.toString() ?? ""),
ItemDetailView(LocaleKeys.creationDate.tr(), poItemHistoryList[index].cREATIONDATE ?? ""),
ItemDetailView(LocaleKeys.supplier.tr(), poItemHistoryList[index].sUPPLIER ?? ""),
ItemDetailView(LocaleKeys.buyer.tr(), poItemHistoryList[index].bUYER ?? ""),
ItemDetailView(LocaleKeys.uom.tr(), poItemHistoryList[index].uOM ?? ""),
ItemDetailView(LocaleKeys.quantityOrdered.tr(), poItemHistoryList[index].qUANTITYORDERED?.toString() ?? ""),
ItemDetailView(LocaleKeys.quantityReceived.tr(), poItemHistoryList[index].qUANTITYRECEIVED?.toString() ?? ""),
ItemDetailView(LocaleKeys.bonusQuantity.tr(), poItemHistoryList[index].bONUSQUANTITY?.toString() ?? ""),
ItemDetailView(LocaleKeys.purchasePrice.tr(), poItemHistoryList[index].pURCHASEPRICE?.toString() ?? ""),
ItemDetailView(LocaleKeys.discountPer.tr(), poItemHistoryList[index].dISCOUNTPERCENTAGE?.toString() ?? ""),
ItemDetailView(LocaleKeys.balanceQuantity.tr(), poItemHistoryList[index].bALANCEQUANTITY?.toString() ?? ""),
ItemDetailView(LocaleKeys.netPrice.tr(), poItemHistoryList[index].nETPRICE?.toString() ?? ""),
ItemDetailView(LocaleKeys.closureStatus.tr(), poItemHistoryList[index].cLOSEDCODE ?? ""),
ItemDetailGrid(
ItemDetailViewCol(LocaleKeys.operatingUnit.tr(), poItemHistoryList[index].oUNAME ?? ""),
ItemDetailViewCol(LocaleKeys.poNumber.tr(), poItemHistoryList[index].pONUMBER ?? ""),
),
ItemDetailGrid(
ItemDetailViewCol(LocaleKeys.revision.tr(), poItemHistoryList[index].rEVISIONNUM?.toString() ?? ""),
ItemDetailViewCol(LocaleKeys.creationDate.tr(), poItemHistoryList[index].cREATIONDATE ?? ""),
),
ItemDetailGrid(
ItemDetailViewCol(LocaleKeys.supplier.tr(), poItemHistoryList[index].sUPPLIER ?? ""),
ItemDetailViewCol(LocaleKeys.buyer.tr(), poItemHistoryList[index].bUYER ?? ""),
),
ItemDetailGrid(
ItemDetailViewCol(LocaleKeys.uom.tr(), poItemHistoryList[index].uOM ?? ""),
ItemDetailViewCol(LocaleKeys.quantityOrdered.tr(), poItemHistoryList[index].qUANTITYORDERED?.toString() ?? ""),
),
ItemDetailGrid(
ItemDetailViewCol(LocaleKeys.quantityReceived.tr(), poItemHistoryList[index].qUANTITYRECEIVED?.toString() ?? ""),
ItemDetailViewCol(LocaleKeys.bonusQuantity.tr(), poItemHistoryList[index].bONUSQUANTITY?.toString() ?? ""),
),
ItemDetailGrid(
ItemDetailViewCol(LocaleKeys.purchasePrice.tr(), poItemHistoryList[index].pURCHASEPRICE?.toString() ?? ""),
ItemDetailViewCol(LocaleKeys.discountPer.tr(), poItemHistoryList[index].dISCOUNTPERCENTAGE?.toString() ?? ""),
),
ItemDetailGrid(
ItemDetailViewCol(LocaleKeys.balanceQuantity.tr(), poItemHistoryList[index].bALANCEQUANTITY?.toString() ?? ""),
ItemDetailViewCol(LocaleKeys.netPrice.tr(), poItemHistoryList[index].nETPRICE?.toString() ?? ""),
),
ItemDetailGrid(
ItemDetailViewCol(LocaleKeys.closureStatus.tr(), poItemHistoryList[index].cLOSEDCODE ?? ""),
Container(),
isItLast: true,
)
],
).objectContainerView(),
separatorBuilder: (cxt, index) => 12.height,
@ -160,20 +196,35 @@ class _ItemHistoryScreenState extends State<ItemHistoryScreen> {
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
ItemDetailView(LocaleKeys.quotationNumber.tr(), quotationAnalysisList[index].qUOTNUM ?? ""),
ItemDetailView(LocaleKeys.vendorName.tr(), quotationAnalysisList[index].vENDORNAME ?? ""),
ItemDetailView(LocaleKeys.itemCode.tr(), quotationAnalysisList[index].iTEMCODE ?? ""),
ItemDetailView(LocaleKeys.description.tr(), quotationAnalysisList[index].iTEMDESC ?? ""),
ItemDetailView(LocaleKeys.quotationQty.tr(), quotationAnalysisList[index].qUOTQTY?.toString() ?? ""),
ItemDetailView(LocaleKeys.quotationUOM.tr(), quotationAnalysisList[index].qUOTUOM ?? ""),
ItemDetailView(LocaleKeys.quotationNetPrice.tr(), quotationAnalysisList[index].qUOTUNITPRICE?.toString() ?? ""),
ItemDetailView(LocaleKeys.quotationLineTotal.tr(), quotationAnalysisList[index].qUOTLINETOTAL?.toString() ?? ""),
ItemDetailView(LocaleKeys.quotationBonusQuantity.tr(), quotationAnalysisList[index].qUOTBONUSQTY ?? ""),
ItemDetailView(LocaleKeys.quotationDeliveryDate.tr(), quotationAnalysisList[index].qUOTDELIVERYDATE ?? ""),
ItemDetailView(LocaleKeys.quotationMFGPartNumber.tr(), quotationAnalysisList[index].qUOTMFGPARTNUM ?? ""),
ItemDetailView(LocaleKeys.rfqNumber.tr(), quotationAnalysisList[index].rFQNUM ?? ""),
ItemDetailView(LocaleKeys.rfqQty.tr(), quotationAnalysisList[index].rFQQTY?.toString() ?? ""),
ItemDetailView(LocaleKeys.rfqUOM.tr(), quotationAnalysisList[index].rFQUOM ?? ""),
ItemDetailGrid(
ItemDetailViewCol(LocaleKeys.quotationNumber.tr(), quotationAnalysisList[index].qUOTNUM ?? ""),
ItemDetailViewCol(LocaleKeys.vendorName.tr(), quotationAnalysisList[index].vENDORNAME ?? ""),
),
ItemDetailGrid(
ItemDetailViewCol(LocaleKeys.itemCode.tr(), quotationAnalysisList[index].iTEMCODE ?? ""),
ItemDetailViewCol(LocaleKeys.description.tr(), quotationAnalysisList[index].iTEMDESC ?? ""),
),
ItemDetailGrid(
ItemDetailViewCol(LocaleKeys.quotationQty.tr(), quotationAnalysisList[index].qUOTQTY?.toString() ?? ""),
ItemDetailViewCol(LocaleKeys.quotationUOM.tr(), quotationAnalysisList[index].qUOTUOM ?? ""),
),
ItemDetailGrid(
ItemDetailViewCol(LocaleKeys.quotationNetPrice.tr(), quotationAnalysisList[index].qUOTUNITPRICE?.toString() ?? ""),
ItemDetailViewCol(LocaleKeys.quotationLineTotal.tr(), quotationAnalysisList[index].qUOTLINETOTAL?.toString() ?? ""),
),
ItemDetailGrid(
ItemDetailViewCol(LocaleKeys.quotationBonusQuantity.tr(), quotationAnalysisList[index].qUOTBONUSQTY ?? ""),
ItemDetailViewCol(LocaleKeys.quotationDeliveryDate.tr(), quotationAnalysisList[index].qUOTDELIVERYDATE ?? ""),
),
ItemDetailGrid(
ItemDetailViewCol(LocaleKeys.quotationMFGPartNumber.tr(), quotationAnalysisList[index].qUOTMFGPARTNUM ?? ""),
ItemDetailViewCol(LocaleKeys.rfqNumber.tr(), quotationAnalysisList[index].rFQNUM ?? ""),
),
ItemDetailGrid(
ItemDetailViewCol(LocaleKeys.rfqQty.tr(), quotationAnalysisList[index].rFQQTY?.toString() ?? ""),
ItemDetailViewCol(LocaleKeys.rfqUOM.tr(), quotationAnalysisList[index].rFQUOM ?? ""),
isItLast: true,
)
],
).objectContainerView(title: "${quotationAnalysisList[index].iTEMCODE}-${quotationAnalysisList[index].iTEMDESC}"),
separatorBuilder: (cxt, index) => 12.height,

@ -14,6 +14,7 @@ import 'package:mohem_flutter_app/generated/locale_keys.g.dart';
import 'package:mohem_flutter_app/models/itg_forms_models/allowed_actions_model.dart';
import 'package:mohem_flutter_app/models/itg_forms_models/itg_request_model.dart';
import 'package:mohem_flutter_app/models/itg_forms_models/request_detail_model.dart';
import 'package:mohem_flutter_app/provider/dashboard_provider_model.dart';
import 'package:mohem_flutter_app/ui/work_list/itg_fragments/approval_level_fragment.dart';
import 'package:mohem_flutter_app/ui/work_list/itg_fragments/request_detail_fragment.dart';
import 'package:mohem_flutter_app/ui/work_list/sheets/delegate_sheet.dart';
@ -21,6 +22,7 @@ import 'package:mohem_flutter_app/widgets/app_bar_widget.dart';
import 'package:mohem_flutter_app/widgets/bottom_sheet.dart';
import 'package:mohem_flutter_app/widgets/button/default_button.dart';
import 'package:mohem_flutter_app/widgets/dialogs/itg_comments_dialog.dart';
import 'package:provider/provider.dart';
class ItgDetailScreen extends StatefulWidget {
ItgDetailScreen({Key? key}) : super(key: key);
@ -42,8 +44,11 @@ class _ItgDetailScreenState extends State<ItgDetailScreen> {
List<AllowedActions> allowedActionList = [];
late DashboardProviderModel providerData;
@override
void initState() {
providerData = Provider.of<DashboardProviderModel>(context, listen: false);
super.initState();
}
@ -78,6 +83,7 @@ class _ItgDetailScreenState extends State<ItgDetailScreen> {
void getDataFromState() {
if (requestDetails == null) {
requestDetails = AppState().requestAllList![AppState().itgWorkListIndex!]; // ModalRoute.of(context)!.settings.arguments as WorkListResponseModel;
providerData.itgFormsModel!.totalCount = providerData.itgFormsModel!.totalCount! - 1;
getItgData();
}
}
@ -274,16 +280,19 @@ class _ItgDetailScreenState extends State<ItgDetailScreen> {
returnActionImage = "assets/images/request_info.svg";
break;
case "ReportGenerated":
returnActionImage = "assets/images/request_info.svg";
returnActionImage = "assets/images/worklist/report_generated.svg";
break;
case "DataCorrected":
returnActionImage = "assets/images/request_info.svg";
returnActionImage = "assets/images/worklist/report_generated.svg";
break;
case "Doable":
returnActionImage = "assets/images/request_info.svg";
returnActionImage = "assets/images/worklist/doable.svg";
break;
case "NotDoable":
returnActionImage = "assets/images/request_info.svg";
returnActionImage = "assets/images/worklist/not_doable.svg";
break;
case "Answer":
returnActionImage = "assets/images/worklist/answer_hr.svg";
break;
default:
returnActionImage = "assets/images/request_info.svg";
@ -358,12 +367,11 @@ class _ItgDetailScreenState extends State<ItgDetailScreen> {
case "Answer":
performAction("Answer");
break;
case "RFC":
// do something else
case "ReportGenerated":
performDataCorrectionORReportGeneratedAction(requestDetails!.requestType!, requestDetails!.iD!, requestDetails!.itemID!, AppState().memberInformationList?.eMPLOYEENUMBER ?? "");
break;
case "UPDATE_ACTION":
// do something else
case "DataCorrected":
performDataCorrectionORReportGeneratedAction(requestDetails!.requestType!, requestDetails!.iD!, requestDetails!.itemID!, AppState().memberInformationList?.eMPLOYEENUMBER ?? "");
break;
}
setState(() {
@ -523,6 +531,29 @@ class _ItgDetailScreenState extends State<ItgDetailScreen> {
}
}
void performDataCorrectionORReportGeneratedAction(String requestType, int taskId, int itemId, String employeeNumber) async {
try {
Utils.showLoading(context);
ITGRequest? itgRequest = await WorkListApiClient().grantITGRequest(requestType, taskId, itemId, employeeNumber, "", "");
Utils.hideLoading(context);
Utils.showToast(LocaleKeys.yourChangeHasBeenSavedSuccessfully.tr());
AppState().requestAllList!.removeAt(AppState().itgWorkListIndex!);
if (AppState().requestAllList!.isEmpty) {
Navigator.pop(context, "delegate_reload");
} else {
if (AppState().requestAllList!.length <= AppState().itgWorkListIndex!) {
Navigator.pop(context, "delegate_reload");
} else {
requestDetails = null;
getDataFromState();
}
}
} catch (ex) {
Utils.hideLoading(context);
Utils.handleException(ex, context, null);
}
}
void reloadITG() {
AppState().requestAllList!.removeAt(AppState().itgWorkListIndex!);
if (AppState().requestAllList!.isEmpty) {

@ -140,7 +140,7 @@ class SelectedItemSheet extends StatelessWidget {
Future<void> performNetworkCall(BuildContext context, {String? email, String? userId}) async {
Utils.showLoading(context);
try {
await WorkListApiClient().submitComment(comment: comment, email: email, userId: userId, notificationId: notificationID, apiMode: apiMode, approverIndex: actionHistoryList!.sEQUENCE);
await WorkListApiClient().submitComment(comment: comment, email: email, userId: userId, notificationId: notificationID, apiMode: apiMode, approverIndex: actionHistoryList != null ? actionHistoryList!.sEQUENCE : null);
Utils.hideLoading(context);
// Navigator.pop(context);
// Navigator.pop(context);
@ -212,7 +212,7 @@ class SelectedItemSheet extends StatelessWidget {
: CircularAvatar(
height: 40,
width: 40,
).toShimmer()
)
: (actionHistoryList != null && actionHistoryList!.eMPLOYEEIMAGE != null)
? CircularAvatar(
height: 40,
@ -223,7 +223,7 @@ class SelectedItemSheet extends StatelessWidget {
: CircularAvatar(
height: 40,
width: 40,
).toShimmer(),
),
16.width,
Expanded(
child: (name ?? "").toText12(),

@ -226,7 +226,6 @@ class _WorkListScreenState extends State<WorkListScreen> {
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(width: double.infinity, height: 1, color: MyColors.lightGreyEFColor),
SizedBox(
height: 40,
child: ListView.separated(
@ -347,6 +346,7 @@ class _WorkListScreenState extends State<WorkListScreen> {
return InkWell(
onTap: () async {
AppState().setItgWorkListIndex = index;
AppState().setItgRequestType = requestDetails.requestType;
var shouldReloadData = await Navigator.pushNamed(context, AppRoutes.itgDetail);
if (shouldReloadData != null) {
if (shouldReloadData.toString() == "delegate_reload") {

@ -404,6 +404,15 @@ class _WorkListDetailScreenState extends State<WorkListDetailScreen> {
case "UPDATE_ACTION":
returnActionImage = "assets/images/worklist/update_action.svg";
break;
case "APPROVE_AND_FORWARD":
returnActionImage = "assets/images/worklist/approve_and_forward.svg";
break;
case "FORWARD":
returnActionImage = "assets/images/worklist/forward.svg";
break;
default:
returnActionImage = "assets/images/request_info.svg";
break;
}
return returnActionImage;
@ -467,6 +476,17 @@ class _WorkListDetailScreenState extends State<WorkListDetailScreen> {
isUpdate: true, collectionNotificationList: getEitCollectionNotificationBodyList![0].collectionNotification)),
);
break;
case "CONTINUE_ACTION":
showMyBottomSheet(
context,
callBackFunc: reloadWorkList,
child: UpdateContinueSheet(
workListData: workListData,
getEitCollectionNotificationBodyList: getEitCollectionNotificationBodyList,
dynamicParams: DynamicListViewParams(workListData!.sUBJECT!, workListData!.fUNCTIONNAME!,
isUpdate: true, collectionNotificationList: getEitCollectionNotificationBodyList![0].collectionNotification)),
);
break;
case "APPROVE_AND_FORWARD":
showMyBottomSheet(context,
callBackFunc: reloadWorkList,

@ -27,7 +27,7 @@ class ActionsFragment extends StatelessWidget {
itemCount: actionHistoryList.length,
padding: EdgeInsets.all(21),
itemBuilder: (context, index) {
return showItem(context, actionHistoryList[index]);
return showItem(context, actionHistoryList[index], index);
},
separatorBuilder: (BuildContext context, int index) {
return 12.height;
@ -36,7 +36,7 @@ class ActionsFragment extends StatelessWidget {
);
}
Widget showItem(BuildContext context, GetActionHistoryList actionHistory) {
Widget showItem(BuildContext context, GetActionHistoryList actionHistory, int index) {
return Container(
width: double.infinity,
decoration: BoxDecoration(
@ -89,7 +89,9 @@ class ActionsFragment extends StatelessWidget {
if (actionHistory.nOTIFICATIONDATE!.isNotEmpty)
DateUtil.formatDateToDate(DateUtil.convertSimpleStringDateToDateddMMyyyy(actionHistory.nOTIFICATIONDATE!), false).toText12(color: MyColors.lightTextColor),
],
)
),
10.height,
getActionDuration(index).toText11(maxLine: 1, color: const Color(0xff1FA269))
],
),
)
@ -127,8 +129,22 @@ class ActionsFragment extends StatelessWidget {
);
}
String getActionDuration(int index) {
if (actionHistoryList[index].aCTIONCODE == "SUBMIT") {
return "";
} else if(actionHistoryList[index].aCTIONCODE == "PENDING") {
DateTime dateTimeFrom = DateUtil.convertSimpleStringDateToDate(actionHistoryList[++index].nOTIFICATIONDATE!);
Duration duration = DateTime.now().difference(dateTimeFrom);
return "Action duration: " + DateUtil.formatDuration(duration);
} else {
DateTime dateTimeTo = DateUtil.convertSimpleStringDateToDate(actionHistoryList[index].nOTIFICATIONDATE!);
DateTime dateTimeFrom = DateUtil.convertSimpleStringDateToDate(actionHistoryList[++index].nOTIFICATIONDATE!);
Duration duration = dateTimeTo.difference(dateTimeFrom);
return "Action duration: " + DateUtil.formatDuration(duration);
}
}
Color getStatusColor(String code) {
print("code:$code");
if (code == "SUBMIT") {
return const Color(0xff2E303A);
} else if (code == "REJECTED") {
@ -139,7 +155,7 @@ class ActionsFragment extends StatelessWidget {
return MyColors.orange;
} else if (code == "APPROVED" || code == "APPROVE" || code == "ANSWER_INFO") {
return const Color(0xff1FA269);
} else if (code == "REQUEST_INFO"|| code == "FORWARD") {
} else if (code == "REQUEST_INFO" || code == "FORWARD") {
return const Color(0xff2E303A);
} else if (code != "SUBMIT" && code != "REJECT" && code != "PENDING") {
return MyColors.orange;

@ -7,11 +7,7 @@ import 'package:mohem_flutter_app/extensions/string_extensions.dart';
import 'package:mohem_flutter_app/extensions/widget_extensions.dart';
AppBar AppBarWidget(BuildContext context,
{required String title,
bool showHomeButton = true,
bool showNotificationButton = false,
bool showMemberButton = false,
String? image}) {
{required String title, bool showHomeButton = true, bool showNotificationButton = false, bool showMemberButton = false, String? image, List<Widget>? actions}) {
return AppBar(
leadingWidth: 0,
// leading: GestureDetector(
@ -24,17 +20,16 @@ AppBar AppBarWidget(BuildContext context,
children: [
GestureDetector(
behavior: HitTestBehavior.opaque,
onTap:
Feedback.wrapForTap(() => Navigator.maybePop(context), context),
child:
const Icon(Icons.arrow_back_ios, color: MyColors.darkIconColor),
onTap: Feedback.wrapForTap(() => Navigator.maybePop(context), context),
child: const Icon(Icons.arrow_back_ios, color: MyColors.darkIconColor),
),
4.width,
if (image != null) SvgPicture.asset(
image,
height: 40,
width: 40,
),
if (image != null)
SvgPicture.asset(
image,
height: 40,
width: 40,
),
if (image != null) 14.width,
title.toText24(color: MyColors.darkTextColor, isBold: true).expanded,
],
@ -46,8 +41,7 @@ AppBar AppBarWidget(BuildContext context,
if (showHomeButton)
IconButton(
onPressed: () {
Navigator.popUntil(
context, ModalRoute.withName(AppRoutes.dashboard));
Navigator.popUntil(context, ModalRoute.withName(AppRoutes.dashboard));
},
icon: const Icon(Icons.home, color: MyColors.darkIconColor),
),
@ -65,6 +59,7 @@ AppBar AppBarWidget(BuildContext context,
},
icon: const Icon(Icons.people, color: MyColors.textMixColor),
),
...actions??[]
],
);
}

@ -136,12 +136,13 @@ class _SearchEmployeeBottomSheetState extends State<SearchEmployeeBottomSheet> {
},
).expanded,
IconButton(
constraints: const BoxConstraints(),
onPressed: () async {
await SystemChannels.textInput.invokeMethod('TextInput.hide');
widget.fromChat ? fetchChatUser() : fetchUserByInput();
},
icon: Icon(Icons.search))
constraints: const BoxConstraints(),
onPressed: () async {
await SystemChannels.textInput.invokeMethod('TextInput.hide');
widget.fromChat ? fetchChatUser() : fetchUserByInput();
},
icon: const Icon(Icons.search),
)
],
),
if (replacementList != null)
@ -183,16 +184,25 @@ class _SearchEmployeeBottomSheetState extends State<SearchEmployeeBottomSheet> {
if (widget.fromChat)
if (chatUsersList != null && widget.fromChat)
chatUsersList!.isEmpty
? Utils.getNoDataWidget(context)
? Column(
children: [
20.height,
Utils.getNoDataWidget(context),
],
)
: ListView(
physics: const BouncingScrollPhysics(),
padding: EdgeInsets.only(top: 0, bottom: 8),
children: [
padding: const EdgeInsets.only(
top: 15,
),
children: <Widget>[
ListView.separated(
physics: const NeverScrollableScrollPhysics(),
shrinkWrap: true,
itemBuilder: (cxt, index) {
return ListTile(
physics: const NeverScrollableScrollPhysics(),
shrinkWrap: true,
itemBuilder: (BuildContext cxt, int index) {
return SizedBox(
height: 55,
child: ListTile(
leading: Stack(
children: [
SvgPicture.asset(
@ -217,24 +227,27 @@ class _SearchEmployeeBottomSheetState extends State<SearchEmployeeBottomSheet> {
],
),
title: (chatUsersList![index].userName ?? "").toText14(color: MyColors.darkTextColor),
// subtitle: (chatUsersList![index].isTyping == true ? "Something is Typing" : "Last message text").toText11(color: MyColors.normalTextColor),
// trailing: ("Today").toText10(color: MyColors.lightTextColor),
minVerticalPadding: 0,
onTap: () {
Navigator.pop(context);
Navigator.pushNamed(
context,
AppRoutes.chatDetailed,
arguments: {"targetUser": chatUsersList![index]},
arguments: {"targetUser": chatUsersList![index], "isNewChat": true},
);
},
);
},
separatorBuilder: (BuildContext cxt, int index) => Container(
height: 1,
color: MyColors.borderE3Color,
),
itemCount: chatUsersList?.length ?? 0),
),
);
},
separatorBuilder: (BuildContext context, int index) => const Padding(
padding: EdgeInsets.only(right: 10, left: 70, bottom: 0, top: 0),
child: Divider(
color: Color(0xFFE5E5E5),
),
),
itemCount: chatUsersList?.length ?? 0,
),
12.height,
],
).expanded,
@ -293,7 +306,9 @@ class _SearchEmployeeBottomSheetState extends State<SearchEmployeeBottomSheet> {
decoration: BoxDecoration(
color: Colors.transparent,
border: Border.all(color: MyColors.borderColor, width: 1),
borderRadius: const BorderRadius.all(Radius.circular(100)),
borderRadius: const BorderRadius.all(
Radius.circular(100),
),
),
padding: const EdgeInsets.all(4),
child: Container(
@ -301,7 +316,9 @@ class _SearchEmployeeBottomSheetState extends State<SearchEmployeeBottomSheet> {
height: double.infinity,
decoration: BoxDecoration(
color: value == groupValue ? MyColors.grey3AColor : Colors.transparent,
borderRadius: BorderRadius.all(const Radius.circular(100)),
borderRadius: const BorderRadius.all(
Radius.circular(100),
),
),
),
),

@ -13,7 +13,7 @@ class ImageOptions {
static void showImageOptionsNew(BuildContext context, bool showFilesOption, Function(String, File) image) {
showMyBottomSheet(
context,
callBackFunc: (){},
callBackFunc: () {},
child: AttachmentOptions(
showFilesOption: showFilesOption,
onCameraTap: () async {
@ -43,7 +43,12 @@ class ImageOptions {
}
},
onFilesTap: () async {
FilePickerResult? result = await FilePicker.platform.pickFiles();
FilePickerResult? result = await FilePicker.platform.pickFiles(
type: FileType.custom,
allowedExtensions: ['jpg', 'jpeg ', 'pdf', 'txt', 'docx', 'doc', 'pptx', 'xlsx', 'png', 'rar', 'zip', 'xls'],
);
List<File> files = result!.paths.map((path) => File(path!)).toList();
image(result.files.first.path.toString(), files.first);
},
),
);

@ -85,9 +85,15 @@ dependencies:
appinio_swiper: ^1.1.1
expandable: ^5.0.1
#Chat
signalr_netcore: ^1.3.3
logging: ^1.0.1
swipe_to: ^1.0.2
flutter_webrtc: ^0.9.16
camera: ^0.10.0+4
@ -128,6 +134,7 @@ flutter:
- assets/audio/
- assets/images/
- assets/images/worklist/
- assets/images/services_icons/
- assets/images/login/
- assets/icons/chat/
- assets/images/logos/

Loading…
Cancel
Save