Compare commits
No commits in common. 'master' and 'sultan-dev' have entirely different histories.
master
...
sultan-dev
@ -1,57 +0,0 @@
|
||||
{
|
||||
"agcgw_all":{
|
||||
"CN":"connect-drcn.dbankcloud.cn",
|
||||
"CN_back":"connect-drcn.hispace.hicloud.com",
|
||||
"DE":"connect-dre.dbankcloud.cn",
|
||||
"DE_back":"connect-dre.hispace.hicloud.com",
|
||||
"RU":"connect-drru.hispace.dbankcloud.ru",
|
||||
"RU_back":"connect-drru.hispace.dbankcloud.cn",
|
||||
"SG":"connect-dra.dbankcloud.cn",
|
||||
"SG_back":"connect-dra.hispace.hicloud.com"
|
||||
},
|
||||
"websocketgw_all":{
|
||||
"CN":"connect-ws-drcn.hispace.dbankcloud.cn",
|
||||
"CN_back":"connect-ws-drcn.hispace.dbankcloud.com",
|
||||
"DE":"connect-ws-dre.hispace.dbankcloud.cn",
|
||||
"DE_back":"connect-ws-dre.hispace.dbankcloud.com",
|
||||
"RU":"connect-ws-drru.hispace.dbankcloud.ru",
|
||||
"RU_back":"connect-ws-drru.hispace.dbankcloud.cn",
|
||||
"SG":"connect-ws-dra.hispace.dbankcloud.cn",
|
||||
"SG_back":"connect-ws-dra.hispace.dbankcloud.com"
|
||||
},
|
||||
"client":{
|
||||
"cp_id":"2640966000002322881",
|
||||
"product_id":"737518067793559971",
|
||||
"client_id":"715996003571874624",
|
||||
"client_secret":"B5B89A56A53847C6BB9D216A8747E75952760DF9A8232239D8744CD847A8FFDA",
|
||||
"project_id":"737518067793559971",
|
||||
"app_id":"104737117",
|
||||
"api_key":"DAEDACKDrYgyco9mjPV9ZUjCSh1kCr/GBV0nseHH0z2mnxlZ41RksOKmyTi+PUTwmGEPK+VxCup4F9oUf4VbDnCsjB7aNBShYcjR+g==",
|
||||
"package_name":"hmg.cloudSolutions.mohem"
|
||||
},
|
||||
"oauth_client":{
|
||||
"client_id":"104737117",
|
||||
"client_type":1
|
||||
},
|
||||
"app_info":{
|
||||
"app_id":"104737117",
|
||||
"package_name":"hmg.cloudSolutions.mohem"
|
||||
},
|
||||
"configuration_version":"3.0",
|
||||
"appInfos":[
|
||||
{
|
||||
"package_name":"hmg.cloudSolutions.mohem",
|
||||
"client":{
|
||||
"app_id":"104737117"
|
||||
},
|
||||
"app_info":{
|
||||
"package_name":"hmg.cloudSolutions.mohem",
|
||||
"app_id":"104737117"
|
||||
},
|
||||
"oauth_client":{
|
||||
"client_type":1,
|
||||
"client_id":"104737117"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
Before Width: | Height: | Size: 732 B |
|
Before Width: | Height: | Size: 702 B |
|
Before Width: | Height: | Size: 48 KiB |
|
Before Width: | Height: | Size: 8.4 KiB |
|
Before Width: | Height: | Size: 610 B |
|
Before Width: | Height: | Size: 2.2 KiB |
|
Before Width: | Height: | Size: 518 B |
|
Before Width: | Height: | Size: 187 KiB |
|
Before Width: | Height: | Size: 48 KiB |
|
Before Width: | Height: | Size: 17 KiB |
@ -1 +0,0 @@
|
||||
var json = {};
|
||||
@ -1,206 +0,0 @@
|
||||
// ignore_for_file: prefer_single_quotes, lines_longer_than_80_chars final
|
||||
// link to generate dart class https://www.webinovers.com/web-tools/json-to-dart-convertor
|
||||
|
||||
Map<String, dynamic> _env = {
|
||||
"appConfig": "lib/config/config_en.json",
|
||||
"login": {
|
||||
"verification": true,
|
||||
"verificationMethod": {
|
||||
"whatsapp": false,
|
||||
},
|
||||
"forgetPassword": false
|
||||
},
|
||||
"bottomBar": false,
|
||||
"dashboard": {
|
||||
"attendance": false,
|
||||
"worklist": true,
|
||||
"ticketBalance": false,
|
||||
"leaveBalance": true,
|
||||
"missingSwipe": false,
|
||||
"monthlyAttendance": false,
|
||||
"vocationRules": false,
|
||||
},
|
||||
"itg": false,
|
||||
"marathon": false,
|
||||
"offersDiscount": false,
|
||||
"myTeams": false,
|
||||
"modifiy": false,
|
||||
"myRequest": false,
|
||||
"pendingTransactions": false,
|
||||
"myProfile": false,
|
||||
"itemsForSale": false,
|
||||
"chat": false,
|
||||
"monthlyAttendance": true,
|
||||
"vocationRules": false,
|
||||
"canEdit": false,
|
||||
};
|
||||
|
||||
Env env = Env.fromJson(_env);
|
||||
|
||||
class Env {
|
||||
Env({
|
||||
required this.appConfig,
|
||||
required this.login,
|
||||
required this.bottomBar,
|
||||
required this.dashboard,
|
||||
required this.itg,
|
||||
required this.marathon,
|
||||
required this.offersDiscount,
|
||||
required this.myTeams,
|
||||
required this.modifiy,
|
||||
required this.myRequest,
|
||||
required this.pendingTransactions,
|
||||
required this.myProfile,
|
||||
required this.itemsForSale,
|
||||
required this.chat,
|
||||
required this.monthlyAttendance,
|
||||
required this.vocationRules,
|
||||
required this.canEdit,
|
||||
});
|
||||
|
||||
late final String appConfig;
|
||||
late final Login login;
|
||||
late final bool bottomBar;
|
||||
late final Dashboard dashboard;
|
||||
late final bool itg;
|
||||
late final bool marathon;
|
||||
late final bool offersDiscount;
|
||||
late final bool myTeams;
|
||||
late final bool modifiy;
|
||||
late final bool myRequest;
|
||||
late final bool pendingTransactions;
|
||||
late final bool myProfile;
|
||||
late final bool itemsForSale;
|
||||
late final bool chat;
|
||||
late final bool monthlyAttendance;
|
||||
late final bool vocationRules;
|
||||
late final bool canEdit;
|
||||
|
||||
Env.fromJson(Map<String, dynamic> json) {
|
||||
appConfig = json['appConfig'];
|
||||
login = Login.fromJson(json['login']);
|
||||
bottomBar = json['bottomBar'];
|
||||
dashboard = Dashboard.fromJson(json['dashboard']);
|
||||
marathon = json['marathon'];
|
||||
itg = json['itg'];
|
||||
offersDiscount = json['offersDiscount'];
|
||||
myTeams = json['myTeams'];
|
||||
modifiy = json['modifiy'];
|
||||
myRequest = json['myRequest'];
|
||||
pendingTransactions = json['pendingTransactions'];
|
||||
myProfile = json['myProfile'];
|
||||
itemsForSale = json['itemsForSale'];
|
||||
chat = json['chat'];
|
||||
monthlyAttendance = json['monthlyAttendance'];
|
||||
vocationRules = json['vocationRules'];
|
||||
canEdit = json['canEdit'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
var _data = <String, dynamic>{};
|
||||
_data['appConfig'] = appConfig;
|
||||
_data['login'] = login.toJson();
|
||||
_data['bottomBar'] = bottomBar;
|
||||
_data['dashboard'] = dashboard.toJson();
|
||||
_data['marathon'] = marathon;
|
||||
_data['itg'] = itg;
|
||||
_data['offersDiscount'] = offersDiscount;
|
||||
_data['myTeams'] = myTeams;
|
||||
_data['modifiy'] = modifiy;
|
||||
_data['myRequest'] = myRequest;
|
||||
_data['pendingTransactions'] = pendingTransactions;
|
||||
_data['myProfile'] = myProfile;
|
||||
_data['itemsForSale'] = itemsForSale;
|
||||
_data['chat'] = chat;
|
||||
_data['monthlyAttendance'] = monthlyAttendance;
|
||||
_data['vocationRules'] = vocationRules;
|
||||
_data['canEdit'] = canEdit;
|
||||
return _data;
|
||||
}
|
||||
}
|
||||
|
||||
class Login {
|
||||
Login({
|
||||
required this.verification,
|
||||
required this.verificationMethod,
|
||||
required this.forgetPassword,
|
||||
});
|
||||
|
||||
late final bool verification;
|
||||
late final VerificationMethod verificationMethod;
|
||||
late final bool forgetPassword;
|
||||
|
||||
Login.fromJson(Map<String, dynamic> json) {
|
||||
verification = json['verification'];
|
||||
verificationMethod = VerificationMethod.fromJson(json['verificationMethod']);
|
||||
forgetPassword = json['forgetPassword'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
var _data = <String, dynamic>{};
|
||||
_data['verification'] = verification;
|
||||
_data['verificationMethod'] = verificationMethod.toJson();
|
||||
_data['forgetPassword'] = forgetPassword;
|
||||
return _data;
|
||||
}
|
||||
}
|
||||
|
||||
class VerificationMethod {
|
||||
VerificationMethod({
|
||||
required this.whatsapp,
|
||||
});
|
||||
|
||||
late final bool whatsapp;
|
||||
|
||||
VerificationMethod.fromJson(Map<String, dynamic> json) {
|
||||
whatsapp = json['whatsapp'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
var _data = <String, dynamic>{};
|
||||
_data['whatsapp'] = whatsapp;
|
||||
return _data;
|
||||
}
|
||||
}
|
||||
|
||||
class Dashboard {
|
||||
Dashboard({
|
||||
required this.attendance,
|
||||
required this.worklist,
|
||||
required this.ticketBalance,
|
||||
required this.leaveBalance,
|
||||
required this.missingSwipe,
|
||||
required this.monthlyAttendance,
|
||||
required this.vocationRules,
|
||||
});
|
||||
|
||||
late final bool attendance;
|
||||
late final bool worklist;
|
||||
late final bool ticketBalance;
|
||||
late final bool leaveBalance;
|
||||
late final bool missingSwipe;
|
||||
late final bool monthlyAttendance;
|
||||
late final bool vocationRules;
|
||||
|
||||
Dashboard.fromJson(Map<String, dynamic> json) {
|
||||
attendance = json['attendance'];
|
||||
worklist = json['worklist'];
|
||||
ticketBalance = json['ticketBalance'];
|
||||
leaveBalance = json['leaveBalance'];
|
||||
missingSwipe = json['missingSwipe'];
|
||||
monthlyAttendance = json['monthlyAttendance'];
|
||||
vocationRules = json['vocationRules'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
var _data = <String, dynamic>{};
|
||||
_data['attendance'] = attendance;
|
||||
_data['worklist'] = worklist;
|
||||
_data['ticketBalance'] = ticketBalance;
|
||||
_data['leaveBalance'] = leaveBalance;
|
||||
_data['missingSwipe'] = missingSwipe;
|
||||
_data['monthlyAttendance'] = monthlyAttendance;
|
||||
_data['vocationRules'] = vocationRules;
|
||||
return _data;
|
||||
}
|
||||
}
|
||||
@ -1,45 +0,0 @@
|
||||
// To parse this JSON data, do
|
||||
//
|
||||
// final employeeLeavesList = employeeLeavesListFromJson(jsonString);
|
||||
|
||||
import 'dart:convert';
|
||||
|
||||
EmployeeLeavesList employeeLeavesListFromJson(String str) => EmployeeLeavesList.fromJson(json.decode(str));
|
||||
|
||||
String employeeLeavesListToJson(EmployeeLeavesList data) => json.encode(data.toJson());
|
||||
|
||||
class EmployeeLeavesList {
|
||||
EmployeeLeavesList({
|
||||
this.absenceAttendanceTypeName,
|
||||
this.dateEnd,
|
||||
this.dateStart,
|
||||
this.eventDate,
|
||||
this.holidayType,
|
||||
this.leaveType,
|
||||
});
|
||||
|
||||
String? absenceAttendanceTypeName;
|
||||
String? dateEnd;
|
||||
String? dateStart;
|
||||
String? eventDate;
|
||||
String? holidayType;
|
||||
String? leaveType;
|
||||
|
||||
factory EmployeeLeavesList.fromJson(Map<String, dynamic> json) => EmployeeLeavesList(
|
||||
absenceAttendanceTypeName: json["ABSENCE_ATTENDANCE_TYPE_NAME"],
|
||||
dateEnd: json["DATE_END"],
|
||||
dateStart: json["DATE_START"],
|
||||
eventDate: json["EVENT_DATE"],
|
||||
holidayType: json["HOLIDAY_TYPE"],
|
||||
leaveType: json["LEAVE_TYPE"],
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"ABSENCE_ATTENDANCE_TYPE_NAME": absenceAttendanceTypeName,
|
||||
"DATE_END": dateEnd,
|
||||
"DATE_START": dateStart,
|
||||
"EVENT_DATE": eventDate,
|
||||
"HOLIDAY_TYPE": holidayType,
|
||||
"LEAVE_TYPE": leaveType,
|
||||
};
|
||||
}
|
||||
@ -1,71 +0,0 @@
|
||||
class SupervisorHierarchyLists {
|
||||
SupervisorHierarchyLists({
|
||||
this.subordinateHierarchyList,
|
||||
this.supervisorHierarchyList,
|
||||
});
|
||||
|
||||
List<HierarchyList>? subordinateHierarchyList;
|
||||
List<HierarchyList>? supervisorHierarchyList;
|
||||
|
||||
factory SupervisorHierarchyLists.fromJson(Map<String, dynamic> json) => SupervisorHierarchyLists(
|
||||
subordinateHierarchyList: json["SubordinateHierarchyList"] == null ? [] : List<HierarchyList>.from(json["SubordinateHierarchyList"]!.map((x) => HierarchyList.fromJson(x))),
|
||||
supervisorHierarchyList: json["SupervisorHierarchyList"] == null ? [] : List<HierarchyList>.from(json["SupervisorHierarchyList"]!.map((x) => HierarchyList.fromJson(x))),
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"SubordinateHierarchyList": subordinateHierarchyList == null ? [] : List<dynamic>.from(subordinateHierarchyList!.map((x) => x.toJson())),
|
||||
"SupervisorHierarchyList": supervisorHierarchyList == null ? [] : List<dynamic>.from(supervisorHierarchyList!.map((x) => x.toJson())),
|
||||
};
|
||||
}
|
||||
|
||||
class HierarchyList {
|
||||
HierarchyList({
|
||||
this.employeeEmailAddress,
|
||||
this.employeeImage,
|
||||
this.employeeMobileNumber,
|
||||
this.employeeName,
|
||||
this.employeeNumber,
|
||||
this.employeeWorkNumber,
|
||||
this.lvl,
|
||||
this.numOfSubordinates,
|
||||
this.organizationName,
|
||||
this.positionName,
|
||||
});
|
||||
|
||||
String? employeeEmailAddress;
|
||||
dynamic employeeImage;
|
||||
String? employeeMobileNumber;
|
||||
String? employeeName;
|
||||
String? employeeNumber;
|
||||
String? employeeWorkNumber;
|
||||
int? lvl;
|
||||
int? numOfSubordinates;
|
||||
String? organizationName;
|
||||
String? positionName;
|
||||
|
||||
factory HierarchyList.fromJson(Map<String, dynamic> json) => HierarchyList(
|
||||
employeeEmailAddress: json["EMPLOYEE_EMAIL_ADDRESS"],
|
||||
employeeImage: json["EMPLOYEE_IMAGE"],
|
||||
employeeMobileNumber: json["EMPLOYEE_MOBILE_NUMBER"],
|
||||
employeeName: json["EMPLOYEE_NAME"],
|
||||
employeeNumber: json["EMPLOYEE_NUMBER"],
|
||||
employeeWorkNumber: json["EMPLOYEE_WORK_NUMBER"],
|
||||
lvl: json["LVL"],
|
||||
numOfSubordinates: json["NUM_OF_SUBORDINATES"],
|
||||
organizationName: json["ORGANIZATION_NAME"],
|
||||
positionName: json["POSITION_NAME"],
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"EMPLOYEE_EMAIL_ADDRESS": employeeEmailAddress,
|
||||
"EMPLOYEE_IMAGE": employeeImage,
|
||||
"EMPLOYEE_MOBILE_NUMBER": employeeMobileNumber,
|
||||
"EMPLOYEE_NAME": employeeName,
|
||||
"EMPLOYEE_NUMBER": employeeNumber,
|
||||
"EMPLOYEE_WORK_NUMBER": employeeWorkNumber,
|
||||
"LVL": lvl,
|
||||
"NUM_OF_SUBORDINATES": numOfSubordinates,
|
||||
"ORGANIZATION_NAME": organizationName,
|
||||
"POSITION_NAME": positionName,
|
||||
};
|
||||
}
|
||||
@ -1,41 +0,0 @@
|
||||
// To parse this JSON data, do
|
||||
//
|
||||
// final employeeQualificationsList = employeeQualificationsListFromJson(jsonString);
|
||||
|
||||
import 'dart:convert';
|
||||
|
||||
EmployeeQualificationsList employeeQualificationsListFromJson(String str) => EmployeeQualificationsList.fromJson(json.decode(str));
|
||||
|
||||
String employeeQualificationsListToJson(EmployeeQualificationsList data) => json.encode(data.toJson());
|
||||
|
||||
class EmployeeQualificationsList {
|
||||
EmployeeQualificationsList({
|
||||
this.establishment,
|
||||
this.grade,
|
||||
this.gradeDescription,
|
||||
this.qualificationType,
|
||||
this.status,
|
||||
});
|
||||
|
||||
String? establishment;
|
||||
String? grade;
|
||||
String? gradeDescription;
|
||||
String? qualificationType;
|
||||
String? status;
|
||||
|
||||
factory EmployeeQualificationsList.fromJson(Map<String, dynamic> json) => EmployeeQualificationsList(
|
||||
establishment: json["ESTABLISHMENT"],
|
||||
grade: json["GRADE"],
|
||||
gradeDescription: json["GRADE_DESCRIPTION"],
|
||||
qualificationType: json["QUALIFICATION_TYPE"],
|
||||
status: json["STATUS"],
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"ESTABLISHMENT": establishment,
|
||||
"GRADE": grade,
|
||||
"GRADE_DESCRIPTION": gradeDescription,
|
||||
"QUALIFICATION_TYPE": qualificationType,
|
||||
"STATUS": status,
|
||||
};
|
||||
}
|
||||
@ -1,187 +0,0 @@
|
||||
import 'dart:convert';
|
||||
import 'dart:ui';
|
||||
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter_webrtc/flutter_webrtc.dart';
|
||||
import 'package:mohem_flutter_app/ui/landing/dashboard_screen.dart';
|
||||
|
||||
class ChatCallProvider with ChangeNotifier, DiagnosticableTreeMixin {
|
||||
///////////////////// Web RTC Video Calling //////////////////////
|
||||
// Video Call
|
||||
late RTCPeerConnection _peerConnection;
|
||||
RTCVideoRenderer _localVideoRenderer = RTCVideoRenderer();
|
||||
final RTCVideoRenderer _remoteRenderer = RTCVideoRenderer();
|
||||
|
||||
MediaStream? _localStream;
|
||||
MediaStream? _remoteStream;
|
||||
|
||||
void initCallListeners() {
|
||||
chatHubConnection.on("OnCallAcceptedAsync", onCallAcceptedAsync);
|
||||
chatHubConnection.on("OnIceCandidateAsync", onIceCandidateAsync);
|
||||
chatHubConnection.on("OnOfferAsync", onOfferAsync);
|
||||
chatHubConnection.on("OnAnswerOffer", onAnswerOffer);
|
||||
chatHubConnection.on("OnHangUpAsync", onHangUpAsync);
|
||||
chatHubConnection.on("OnCallDeclinedAsync", onCallDeclinedAsync);
|
||||
}
|
||||
|
||||
//Video Constraints
|
||||
var videoConstraints = {
|
||||
"video": {
|
||||
"mandatory": {
|
||||
"width": {"min": 320},
|
||||
"height": {"min": 180}
|
||||
},
|
||||
"optional": [
|
||||
{
|
||||
"width": {"max": 1280}
|
||||
},
|
||||
{"frameRate": 25},
|
||||
{"facingMode": "user"}
|
||||
]
|
||||
},
|
||||
"frameRate": 25,
|
||||
"width": 420, //420,//640,//1280,
|
||||
"height": 240 //240//480//720
|
||||
};
|
||||
|
||||
// Audio Constraints
|
||||
var audioConstraints = {
|
||||
"sampleRate": 8000,
|
||||
"sampleSize": 16,
|
||||
"channelCount": 2,
|
||||
"echoCancellation": true,
|
||||
"audio": true,
|
||||
};
|
||||
|
||||
Future<RTCPeerConnection> _createPeerConnection() async {
|
||||
// {"url": "stun:stun.l.google.com:19302"},
|
||||
Map<String, dynamic> configuration = {
|
||||
"iceServers": [
|
||||
{"urls": 'stun:15.185.116.59:3478'},
|
||||
{"urls": "turn:15.185.116.59:3479", "username": "admin", "credential": "admin"}
|
||||
]
|
||||
};
|
||||
|
||||
Map<String, dynamic> offerSdpConstraints = {
|
||||
"mandatory": {
|
||||
"OfferToReceiveAudio": true,
|
||||
"OfferToReceiveVideo": true,
|
||||
},
|
||||
"optional": [],
|
||||
};
|
||||
|
||||
RTCPeerConnection pc = await createPeerConnection(configuration, offerSdpConstraints);
|
||||
// if (pc != null) print(pc);
|
||||
//pc.addStream(widget.localStream);
|
||||
|
||||
pc.onIceCandidate = (e) {
|
||||
if (e.candidate != null) {
|
||||
print(json.encode({
|
||||
'candidate': e.candidate.toString(),
|
||||
'sdpMid': e.sdpMid.toString(),
|
||||
'sdpMlineIndex': e.sdpMLineIndex,
|
||||
}));
|
||||
}
|
||||
};
|
||||
pc.onIceConnectionState = (e) {
|
||||
print(e);
|
||||
};
|
||||
pc.onAddStream = (stream) {
|
||||
print('addStream: ' + stream.id);
|
||||
_remoteRenderer.srcObject = stream;
|
||||
};
|
||||
return pc;
|
||||
}
|
||||
|
||||
void init() {
|
||||
initRenderers();
|
||||
_createPeerConnection().then((pc) {
|
||||
_peerConnection = pc;
|
||||
// _setRemoteDescription(widget.info);
|
||||
});
|
||||
}
|
||||
|
||||
void initRenderers() {
|
||||
_localVideoRenderer.initialize();
|
||||
_remoteRenderer.initialize();
|
||||
initLocalCamera();
|
||||
}
|
||||
|
||||
void initLocalCamera() async {
|
||||
_localStream = await navigator.mediaDevices.getUserMedia({'video': true, 'audio': true});
|
||||
_localVideoRenderer.srcObject = _localStream;
|
||||
// _localVideoRenderer.srcObject = await navigator.mediaDevices
|
||||
// .getUserMedia({'video': true, 'audio': true});
|
||||
print('this source Object');
|
||||
print('this suarce ${_localVideoRenderer.srcObject != null}');
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
void startCall({required String callType}) {}
|
||||
|
||||
void endCall() {}
|
||||
|
||||
void checkCall(Map<String, dynamic> message) {
|
||||
switch (message["callStatus"]) {
|
||||
case 'connected':
|
||||
{}
|
||||
break;
|
||||
case 'offer':
|
||||
{}
|
||||
break;
|
||||
case 'accept':
|
||||
{}
|
||||
break;
|
||||
case 'candidate':
|
||||
{}
|
||||
break;
|
||||
case 'bye':
|
||||
{}
|
||||
break;
|
||||
case 'leave':
|
||||
{}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//// Listeners Methods ////
|
||||
|
||||
void onCallAcceptedAsync(List<Object?>? params) {}
|
||||
|
||||
void onIceCandidateAsync(List<Object?>? params) {}
|
||||
|
||||
void onOfferAsync(List<Object?>? params) {}
|
||||
|
||||
void onAnswerOffer(List<Object?>? params) {}
|
||||
|
||||
void onHangUpAsync(List<Object?>? params) {}
|
||||
|
||||
void onCallDeclinedAsync(List<Object?>? params) {}
|
||||
|
||||
//// Invoke Methods
|
||||
|
||||
Future<void> invoke({required String invokeMethod, required String currentUserID, required String targetUserID, bool isVideoCall = false, var data}) async {
|
||||
List<Object> args = [];
|
||||
if (invokeMethod == "answerCallAsync") {
|
||||
args = [currentUserID, targetUserID];
|
||||
} else if (invokeMethod == "CallUserAsync") {
|
||||
args = [currentUserID, targetUserID, isVideoCall];
|
||||
} else if (invokeMethod == "IceCandidateAsync") {
|
||||
args = [targetUserID, data];
|
||||
} else if (invokeMethod == "OfferAsync") {
|
||||
args = [targetUserID, data];
|
||||
} else if (invokeMethod == "AnswerOfferAsync") {
|
||||
args = [targetUserID, data];
|
||||
//json In Data
|
||||
}
|
||||
await chatHubConnection.invoke(invokeMethod, args: args);
|
||||
}
|
||||
|
||||
void stopListeners() async {
|
||||
chatHubConnection.off('OnCallDeclinedAsync');
|
||||
chatHubConnection.off('OnCallAcceptedAsync');
|
||||
chatHubConnection.off('OnIceCandidateAsync');
|
||||
chatHubConnection.off('OnAnswerOffer');
|
||||
}
|
||||
}
|
||||
@ -1,358 +0,0 @@
|
||||
import 'package:easy_localization/easy_localization.dart';
|
||||
import 'package:easy_localization/src/public_ext.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/painting.dart';
|
||||
import 'package:flutter_html/flutter_html.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:mohem_flutter_app/api/monthly_attendance_api_client.dart';
|
||||
import 'package:mohem_flutter_app/classes/colors.dart';
|
||||
import 'package:mohem_flutter_app/classes/date_uitl.dart';
|
||||
import 'package:mohem_flutter_app/classes/utils.dart';
|
||||
import 'package:mohem_flutter_app/extensions/int_extensions.dart';
|
||||
import 'package:mohem_flutter_app/extensions/string_extensions.dart';
|
||||
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/employee_leaves_list.dart';
|
||||
import 'package:mohem_flutter_app/models/get_day_hours_type_details_list_model.dart';
|
||||
import 'package:mohem_flutter_app/models/get_schedule_shifts_details_list_model.dart';
|
||||
import 'package:mohem_flutter_app/models/get_time_card_summary_list_model.dart';
|
||||
import 'package:mohem_flutter_app/widgets/app_bar_widget.dart';
|
||||
import 'package:mohem_flutter_app/widgets/circular_step_progress_bar.dart';
|
||||
import 'package:month_picker_dialog_2/month_picker_dialog_2.dart';
|
||||
import 'package:pie_chart/pie_chart.dart';
|
||||
import 'package:sizer/sizer.dart';
|
||||
import 'package:syncfusion_flutter_calendar/calendar.dart';
|
||||
|
||||
enum LeaveType { ABSENCE, BUSINESS_TRIP, HOLIDAY, NORMAL }
|
||||
|
||||
class MoeMonthlyAttendanceScreen extends StatefulWidget {
|
||||
@override
|
||||
State<MoeMonthlyAttendanceScreen> createState() => _MoeMonthlyAttendanceScreenState();
|
||||
}
|
||||
|
||||
class _MoeMonthlyAttendanceScreenState extends State<MoeMonthlyAttendanceScreen> {
|
||||
DateTime currentDate = DateTime.now();
|
||||
int searchYear = DateTime.now().year;
|
||||
final CalendarController _calendarController = CalendarController();
|
||||
|
||||
List<EmployeeLeavesList> employeeLeavesList = [];
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
getLeavesData(currentDate);
|
||||
// callTimeCardAndHourDetails(date.day, searchMonth, searchYear);
|
||||
}
|
||||
|
||||
void getLeavesData(DateTime date) async {
|
||||
try {
|
||||
Utils.showLoading(context);
|
||||
String startDate = '${date.year}-${date.month}-${date.day}';
|
||||
int lastday = DateTime(date.year, date.month + 1, 0).day;
|
||||
String endDate = '${date.year}-${date.month}-$lastday';
|
||||
employeeLeavesList = await MonthlyAttendanceApiClient().getEmployeeLeaves(startDate, endDate);
|
||||
Utils.hideLoading(context);
|
||||
_calendarController.displayDate = date;
|
||||
setState(() {});
|
||||
} catch (ex) {
|
||||
Utils.hideLoading(context);
|
||||
Utils.handleException(ex, context, null);
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
backgroundColor: Colors.white,
|
||||
appBar: AppBarWidget(
|
||||
context,
|
||||
// title: LocaleKeys.mowadhafhiRequest.tr(),
|
||||
title: "",
|
||||
// showHomeButton: true,
|
||||
),
|
||||
body: ListView(
|
||||
scrollDirection: Axis.vertical,
|
||||
children: [
|
||||
Column(
|
||||
children: [
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
LocaleKeys.attendance.tr().toText24(isBold: true, color: MyColors.grey3AColor),
|
||||
Row(
|
||||
children: [
|
||||
"${DateFormat("MMMM-yyyy").format(currentDate)}".toText16(color: MyColors.greyACColor),
|
||||
const Icon(Icons.keyboard_arrow_down_rounded, color: MyColors.greyACColor),
|
||||
],
|
||||
).onPress(() async {
|
||||
showMonthPicker(
|
||||
context: context,
|
||||
//locale: EasyLocalization.of(context)?.locale,
|
||||
initialDate: currentDate,
|
||||
firstDate: DateTime(searchYear - 2),
|
||||
lastDate: DateTime.now(),
|
||||
confirmText: Text(LocaleKeys.confirm.tr()),
|
||||
cancelText: Text(LocaleKeys.cancel.tr()),
|
||||
).then((selectedDate) {
|
||||
if (selectedDate != null) {
|
||||
getLeavesData(selectedDate);
|
||||
setState(() {
|
||||
currentDate = selectedDate;
|
||||
});
|
||||
}
|
||||
});
|
||||
}),
|
||||
18.height,
|
||||
AspectRatio(aspectRatio: 304 / 244, child: calendarWidget()),
|
||||
12.height,
|
||||
SizedBox(
|
||||
width: double.infinity,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
children: [
|
||||
showColorItem("Absence", MyColors.pinkDarkColor),
|
||||
showColorItem("Business Trip", MyColors.gradiantStartColor),
|
||||
showColorItem("Holiday", MyColors.gradiantEndColor),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
).paddingOnly(left: 21, right: 21, top: 21),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget showColorItem(String title, Color color) {
|
||||
return Row(
|
||||
children: [
|
||||
Container(
|
||||
width: 20,
|
||||
height: 20,
|
||||
color: color,
|
||||
).circle(2000),
|
||||
8.width,
|
||||
title.toText12()
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Widget calendarWidget() {
|
||||
return SfCalendar(
|
||||
view: CalendarView.month,
|
||||
showDatePickerButton: false,
|
||||
controller: _calendarController,
|
||||
backgroundColor: Colors.white,
|
||||
headerHeight: 0,
|
||||
viewNavigationMode: ViewNavigationMode.none,
|
||||
todayHighlightColor: MyColors.grey3AColor,
|
||||
showNavigationArrow: false,
|
||||
showCurrentTimeIndicator: false,
|
||||
showWeekNumber: false,
|
||||
cellBorderColor: Colors.white,
|
||||
onTap: (v) {
|
||||
dynamic index = v.date?.day;
|
||||
if (index != null) {
|
||||
index = index - 1;
|
||||
}
|
||||
EmployeeLeavesList leaves = employeeLeavesList[index];
|
||||
if (leaves.leaveType != LeaveType.NORMAL.name) {
|
||||
showModalBottomSheet(
|
||||
context: context,
|
||||
shape: const RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.only(
|
||||
topLeft: Radius.circular(25.0),
|
||||
topRight: Radius.circular(25.0),
|
||||
)),
|
||||
isScrollControlled: true,
|
||||
backgroundColor: MyColors.white,
|
||||
builder: (_) {
|
||||
return DraggableScrollableSheet(
|
||||
maxChildSize: 0.75,
|
||||
expand: false,
|
||||
initialChildSize: 0.75,
|
||||
builder: (_, controller) {
|
||||
return Column(
|
||||
children: [
|
||||
Container(
|
||||
width: 49,
|
||||
height: 7,
|
||||
margin: const EdgeInsets.symmetric(vertical: 10),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(25),
|
||||
color: MyColors.darkGreyColor,
|
||||
),
|
||||
),
|
||||
16.height,
|
||||
Container(
|
||||
padding: const EdgeInsets.symmetric(vertical: 12, horizontal: 40),
|
||||
margin: const EdgeInsets.only(left: 20, right: 20),
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(
|
||||
color: Colors.black,
|
||||
),
|
||||
borderRadius: BorderRadius.circular(12)),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
DateUtil.getWeekDay(DateUtil.convertStringToDateTime(leaves.eventDate ?? "").weekday).toString().toText14(),
|
||||
DateUtil.convertStringToDateTime(leaves.eventDate ?? "").day.toString().toText20(),
|
||||
DateUtil.getMonth(DateUtil.convertStringToDateTime(leaves.eventDate ?? "").month).toString().toText14(),
|
||||
DateUtil.convertStringToDateTime(leaves.eventDate ?? "").year.toString().toText14(),
|
||||
],
|
||||
),
|
||||
),
|
||||
6.height,
|
||||
showText(LocaleKeys.leaveType.tr(), leaves.leaveType.toString()),
|
||||
// if (leaves.absenceAttendanceTypeName.toString().isNotEmpty)
|
||||
// const Divider(
|
||||
// color: MyColors.borderCEColor,
|
||||
// ),
|
||||
// if (leaves.absenceAttendanceTypeName.toString().isNotEmpty) showText(LocaleKeys.attendanceType.tr(), leaves.absenceAttendanceTypeName.toString()),
|
||||
const Divider(
|
||||
color: MyColors.borderCEColor,
|
||||
),
|
||||
showText(LocaleKeys.startDateT.tr(), leaves.dateStart.toString()),
|
||||
const Divider(
|
||||
color: MyColors.borderCEColor,
|
||||
),
|
||||
showText(LocaleKeys.endDate.tr(), leaves.dateEnd.toString()),
|
||||
],
|
||||
);
|
||||
},
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
},
|
||||
selectionDecoration: BoxDecoration(
|
||||
border: Border.all(color: MyColors.white, width: 1),
|
||||
shape: BoxShape.circle,
|
||||
),
|
||||
dataSource: MeetingDataSource(_getDataSource()),
|
||||
// onTap: calendarTapped,
|
||||
monthViewSettings: const MonthViewSettings(
|
||||
dayFormat: 'EEE',
|
||||
showTrailingAndLeadingDates: false,
|
||||
showAgenda: false,
|
||||
),
|
||||
viewHeaderStyle: const ViewHeaderStyle(
|
||||
dayTextStyle: TextStyle(color: MyColors.grey3AColor, fontSize: 13, fontWeight: FontWeight.w600),
|
||||
),
|
||||
monthCellBuilder: (build, details) {
|
||||
LeaveType leaveType = LeaveType.NORMAL;
|
||||
for (int i = 0; i < employeeLeavesList.length; i++) {
|
||||
if (details.date.day == DateUtil.convertSimpleStringDateToDateddMMyyyy(employeeLeavesList[i].eventDate ?? "").day) {
|
||||
if (employeeLeavesList[i].leaveType == LeaveType.ABSENCE.name) {
|
||||
leaveType = LeaveType.ABSENCE;
|
||||
} else if (employeeLeavesList[i].leaveType == LeaveType.BUSINESS_TRIP.name) {
|
||||
leaveType = LeaveType.BUSINESS_TRIP;
|
||||
} else if (employeeLeavesList[i].leaveType == LeaveType.HOLIDAY.name) {
|
||||
leaveType = LeaveType.HOLIDAY;
|
||||
}
|
||||
}
|
||||
}
|
||||
return Container(
|
||||
margin: const EdgeInsets.all(4),
|
||||
decoration: BoxDecoration(
|
||||
color: leaveType == LeaveType.ABSENCE
|
||||
? MyColors.pinkDarkColor
|
||||
: leaveType == LeaveType.BUSINESS_TRIP
|
||||
? MyColors.gradiantStartColor
|
||||
: leaveType == LeaveType.HOLIDAY
|
||||
? MyColors.gradiantEndColor
|
||||
: MyColors.white,
|
||||
shape: BoxShape.circle,
|
||||
border: Border.all(
|
||||
color: leaveType == LeaveType.ABSENCE
|
||||
? MyColors.pinkDarkColor
|
||||
: leaveType == LeaveType.BUSINESS_TRIP
|
||||
? MyColors.gradiantStartColor
|
||||
: leaveType == LeaveType.HOLIDAY
|
||||
? MyColors.gradiantEndColor
|
||||
: MyColors.black,
|
||||
width: 2,
|
||||
),
|
||||
),
|
||||
alignment: Alignment.center,
|
||||
child: Text(
|
||||
"${details.date.day}",
|
||||
style: TextStyle(fontSize: 13, fontWeight: FontWeight.w500, color: leaveType == LeaveType.NORMAL ? MyColors.black : MyColors.white),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
List<Meeting> _getDataSource() {
|
||||
List<Meeting> meetings = <Meeting>[];
|
||||
return meetings;
|
||||
}
|
||||
|
||||
Widget showText(String title, String value) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.all(16.0),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
value.toText18(color: MyColors.gradiantEndColor, isBold: true),
|
||||
title.toText14(color: MyColors.greyACColor, isBold: false),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class MeetingDataSource extends CalendarDataSource {
|
||||
MeetingDataSource(List<Meeting> source) {
|
||||
appointments = source;
|
||||
}
|
||||
|
||||
@override
|
||||
DateTime getStartTime(int index) {
|
||||
return _getMeetingData(index).from;
|
||||
}
|
||||
|
||||
@override
|
||||
DateTime getEndTime(int index) {
|
||||
return _getMeetingData(index).to;
|
||||
}
|
||||
|
||||
@override
|
||||
String getSubject(int index) {
|
||||
return _getMeetingData(index).eventName;
|
||||
}
|
||||
|
||||
@override
|
||||
Color getColor(int index) {
|
||||
return _getMeetingData(index).background;
|
||||
}
|
||||
|
||||
@override
|
||||
bool isAllDay(int index) {
|
||||
return _getMeetingData(index).isAllDay;
|
||||
}
|
||||
|
||||
Meeting _getMeetingData(int index) {
|
||||
dynamic meeting = appointments;
|
||||
Meeting meetingData;
|
||||
if (meeting is Meeting) {
|
||||
meetingData = meeting;
|
||||
}
|
||||
return meeting;
|
||||
}
|
||||
}
|
||||
|
||||
class Meeting {
|
||||
Meeting(this.eventName, this.from, this.to, this.background, this.isAllDay);
|
||||
|
||||
String eventName;
|
||||
DateTime from;
|
||||
DateTime to;
|
||||
Color background;
|
||||
bool isAllDay;
|
||||
}
|
||||
@ -1,38 +0,0 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:intl/intl.dart' as intl;
|
||||
|
||||
class CustomAutoDirection extends StatefulWidget {
|
||||
final String text;
|
||||
final Widget child;
|
||||
final void Function(bool isRTL)? onDirectionChange;
|
||||
|
||||
const CustomAutoDirection({Key? key, required this.text, required this.child, this.onDirectionChange}) : super(key: key);
|
||||
|
||||
@override
|
||||
_CustomAutoDirectionState createState() => _CustomAutoDirectionState();
|
||||
}
|
||||
|
||||
class _CustomAutoDirectionState extends State<CustomAutoDirection> {
|
||||
late String text;
|
||||
late Widget childWidget;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
text = widget.text;
|
||||
childWidget = widget.child;
|
||||
return Directionality(textDirection: isRTL(text) ? TextDirection.rtl : TextDirection.ltr, child: childWidget);
|
||||
}
|
||||
|
||||
@override
|
||||
void didUpdateWidget(CustomAutoDirection oldWidget) {
|
||||
if (isRTL(oldWidget.text) != isRTL(widget.text)) {
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) => widget.onDirectionChange?.call(isRTL(widget.text)));
|
||||
}
|
||||
super.didUpdateWidget(oldWidget);
|
||||
}
|
||||
|
||||
bool isRTL(String text) {
|
||||
if (text.isEmpty) return Directionality.of(context) == TextDirection.rtl;
|
||||
return intl.Bidi.detectRtlDirectionality(text);
|
||||
}
|
||||
}
|
||||
@ -1,594 +0,0 @@
|
||||
// import 'dart:async';
|
||||
// import 'dart:io';
|
||||
//
|
||||
// import 'dart:ui' as ui;
|
||||
// import 'package:easy_localization/easy_localization.dart';
|
||||
// import 'package:flutter/material.dart';
|
||||
// import 'package:flutter_countdown_timer/flutter_countdown_timer.dart';
|
||||
// import 'package:flutter_svg/flutter_svg.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/env.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/models/offers_and_discounts/get_offers_list.dart';
|
||||
// import 'package:mohem_flutter_app/provider/chat_provider_model.dart';
|
||||
// import 'package:mohem_flutter_app/provider/dashboard_provider_model.dart';
|
||||
// import 'package:mohem_flutter_app/ui/landing/widget/app_drawer.dart';
|
||||
// import 'package:mohem_flutter_app/ui/landing/widget/menus_widget.dart';
|
||||
// import 'package:mohem_flutter_app/ui/landing/widget/services_widget.dart';
|
||||
// import 'package:mohem_flutter_app/ui/marathon/marathon_provider.dart';
|
||||
// import 'package:mohem_flutter_app/ui/marathon/widgets/marathon_banner.dart';
|
||||
// import 'package:mohem_flutter_app/widgets/bottom_sheet.dart';
|
||||
// import 'package:mohem_flutter_app/widgets/mark_attendance_widget.dart';
|
||||
// import 'package:mohem_flutter_app/widgets/shimmer/dashboard_shimmer_widget.dart';
|
||||
// import 'package:mohem_flutter_app/widgets/shimmer/offers_shimmer_widget.dart';
|
||||
// import 'package:provider/provider.dart';
|
||||
// import 'package:pull_to_refresh/pull_to_refresh.dart';
|
||||
// import 'package:signalr_netcore/signalr_client.dart';
|
||||
//
|
||||
// late HubConnection chatHubConnection;
|
||||
//
|
||||
// class DashboardScreen extends StatefulWidget {
|
||||
// DashboardScreen({Key? key}) : super(key: key);
|
||||
//
|
||||
// @override
|
||||
// _DashboardScreenState createState() {
|
||||
// return _DashboardScreenState();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// class _DashboardScreenState extends State<DashboardScreen> {
|
||||
// late DashboardProviderModel data;
|
||||
// late MarathonProvider marathonProvider;
|
||||
// late ChatProviderModel cProvider;
|
||||
// final GlobalKey<ScaffoldState> _scaffoldState = GlobalKey();
|
||||
//
|
||||
// final RefreshController _refreshController = RefreshController(initialRefresh: false);
|
||||
//
|
||||
// int currentIndex = 0;
|
||||
//
|
||||
// @override
|
||||
// void initState() {
|
||||
// super.initState();
|
||||
// scheduleMicrotask(() {
|
||||
// data = Provider.of<DashboardProviderModel>(context, listen: false);
|
||||
// if (env["marathon"]) {
|
||||
// marathonProvider = Provider.of<MarathonProvider>(context, listen: false);
|
||||
// }
|
||||
// if (env["chat"]) {
|
||||
// cProvider = Provider.of<ChatProviderModel>(context, listen: false);
|
||||
// }
|
||||
// _onRefresh();
|
||||
// });
|
||||
// }
|
||||
//
|
||||
// @override
|
||||
// void dispose() {
|
||||
// super.dispose();
|
||||
// chatHubConnection.stop();
|
||||
// }
|
||||
//
|
||||
// void _bHubCon() {
|
||||
// cProvider.getUserAutoLoginToken().whenComplete(() {
|
||||
// cProvider.buildHubConnection();
|
||||
// Future.delayed(const Duration(seconds: 2), () {
|
||||
// cProvider.invokeChatCounter(userId: AppState().chatDetails!.response!.id!);
|
||||
// });
|
||||
// });
|
||||
// }
|
||||
//
|
||||
// void _onRefresh() async {
|
||||
// data.initProvider();
|
||||
// if (env["chat"]) {
|
||||
// _bHubCon();
|
||||
// }
|
||||
// // data.getITGNotification().then((value) {
|
||||
// // print("--------------------detail_1-----------------");
|
||||
// // print(value!.result!.data!.notificationMasterId);
|
||||
// // print(value.result!.data!.notificationTitle);
|
||||
// // });
|
||||
// data.fetchListMenu();
|
||||
// if (env["dashboard"]["attendance"]) {
|
||||
// data.fetchAttendanceTracking(context);
|
||||
// }
|
||||
// data.fetchWorkListCounter(context);
|
||||
// if (env["dashboard"]["missingSwipe"]) {
|
||||
// data.fetchMissingSwipe(context);
|
||||
// }
|
||||
// data.fetchLeaveTicketBalance(context, DateTime.now());
|
||||
// data.fetchMenuEntries();
|
||||
// data.getCategoryOffersListAPI(context);
|
||||
// if (env["marathon"]) {
|
||||
// marathonProvider.getMarathonDetailsFromApi();
|
||||
// }
|
||||
// _refreshController.refreshCompleted();
|
||||
// }
|
||||
//
|
||||
// @override
|
||||
// Widget build(BuildContext context) {
|
||||
// return Scaffold(
|
||||
// key: _scaffoldState,
|
||||
// // appBar: AppBar(
|
||||
// // actions: [
|
||||
// // IconButton(
|
||||
// // onPressed: () {
|
||||
// // data.getITGNotification().then((val) {
|
||||
// // if (val!.result!.data != null) {
|
||||
// // print("-------------------- Survey ----------------------------");
|
||||
// // if (val.result!.data!.notificationType == "Survey") {
|
||||
// // Navigator.pushNamed(context, AppRoutes.survey, arguments: val.result!.data);
|
||||
// // } else {
|
||||
// // print("------------------------------------------- Ads --------------------");
|
||||
// // DashboardApiClient().getAdvertisementDetail(val.result!.data!.notificationMasterId ?? "").then(
|
||||
// // (value) {
|
||||
// // if (value!.mohemmItgResponseItem!.statusCode == 200) {
|
||||
// // if (value.mohemmItgResponseItem!.result!.data != null) {
|
||||
// // Navigator.pushNamed(context, AppRoutes.advertisement, arguments: {
|
||||
// // "masterId": val.result!.data!.notificationMasterId,
|
||||
// // "advertisement": value.mohemmItgResponseItem!.result!.data!.advertisement,
|
||||
// // });
|
||||
// //
|
||||
// // // Navigator.push(
|
||||
// // // context,
|
||||
// // // MaterialPageRoute(
|
||||
// // // builder: (BuildContext context) => ITGAdsScreen(
|
||||
// // // addMasterId: val.result!.data!.notificationMasterId!,
|
||||
// // // advertisement: value.mohemmItgResponseItem!.result!.data!.advertisement!,
|
||||
// // // ),
|
||||
// // // ),
|
||||
// // // );
|
||||
// // }
|
||||
// // }
|
||||
// // },
|
||||
// // );
|
||||
// // }
|
||||
// // }
|
||||
// // });
|
||||
// // },
|
||||
// // icon: Icon(Icons.add))
|
||||
// // ],
|
||||
// // ),
|
||||
// body: Column(
|
||||
// children: [
|
||||
// Row(
|
||||
// children: [
|
||||
// Builder(builder: (BuildContext context) {
|
||||
// return Row(
|
||||
// mainAxisSize: MainAxisSize.min,
|
||||
// children: [
|
||||
// Image.memory(
|
||||
// Utils.dataFromBase64String(
|
||||
// AppState().memberInformationList!.eMPLOYEEIMAGE ?? "",
|
||||
// ),
|
||||
// errorBuilder: (BuildContext context, Object error, StackTrace? stackTrace) {
|
||||
// return SvgPicture.asset(
|
||||
// "assets/images/user.svg",
|
||||
// height: 34,
|
||||
// width: 34,
|
||||
// );
|
||||
// },
|
||||
// width: 34,
|
||||
// height: 34,
|
||||
// fit: BoxFit.cover,
|
||||
// ).circle(50),
|
||||
// // CircularAvatar(
|
||||
// // width: 34,
|
||||
// // height: 34,
|
||||
// // url: "https://cdn4.iconfinder.com/data/icons/professions-2-2/151/89-512.png",
|
||||
// // ),
|
||||
// 8.width,
|
||||
// SvgPicture.asset("assets/images/side_nav.svg"),
|
||||
// ],
|
||||
// ).onPress(() {
|
||||
// _scaffoldState.currentState!.openDrawer();
|
||||
// });
|
||||
// }),
|
||||
// Image.asset("assets/images/logos/main_mohemm_logo.png", width: 134, height: 28).expanded,
|
||||
// SvgPicture.asset(
|
||||
// "assets/images/announcements.svg",
|
||||
// matchTextDirection: true,
|
||||
// ).onPress(
|
||||
// () async {
|
||||
// await Navigator.pushNamed(context, AppRoutes.announcements);
|
||||
// },
|
||||
// )
|
||||
// ],
|
||||
// ).paddingOnly(left: 21, right: 21, top: 48, bottom: 7),
|
||||
// Expanded(
|
||||
// child: SmartRefresher(
|
||||
// enablePullDown: true,
|
||||
// enablePullUp: false,
|
||||
// header: const MaterialClassicHeader(
|
||||
// color: MyColors.gradiantEndColor,
|
||||
// ),
|
||||
// controller: _refreshController,
|
||||
// onRefresh: _onRefresh,
|
||||
// child: SingleChildScrollView(
|
||||
// child: Column(
|
||||
// children: [
|
||||
// Column(
|
||||
// crossAxisAlignment: CrossAxisAlignment.start,
|
||||
// children: [
|
||||
// LocaleKeys.welcomeBack.tr().toText14(color: MyColors.grey77Color),
|
||||
// (AppState().memberInformationList!.eMPLOYEENAME ?? "").toText24(isBold: true),
|
||||
// 16.height,
|
||||
// Row(
|
||||
// children: [
|
||||
// if (env["dashboard"]["attendance"])
|
||||
// Expanded(
|
||||
// child: AspectRatio(
|
||||
// aspectRatio: 159 / 159,
|
||||
// child: Consumer<DashboardProviderModel>(
|
||||
// builder: (BuildContext context, DashboardProviderModel model, Widget? child) {
|
||||
// return (model.isAttendanceTrackingLoading
|
||||
// ? GetAttendanceTrackingShimmer()
|
||||
// : Container(
|
||||
// decoration: BoxDecoration(
|
||||
// borderRadius: BorderRadius.circular(15),
|
||||
// gradient: const LinearGradient(
|
||||
// transform: GradientRotation(.46),
|
||||
// begin: Alignment.topRight,
|
||||
// end: Alignment.bottomLeft,
|
||||
// colors: [
|
||||
// MyColors.gradiantEndColor,
|
||||
// MyColors.gradiantStartColor,
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
// child: Stack(
|
||||
// alignment: Alignment.center,
|
||||
// children: [
|
||||
// if (model.isTimeRemainingInSeconds == 0) SvgPicture.asset("assets/images/thumb.svg"),
|
||||
// Column(
|
||||
// crossAxisAlignment: CrossAxisAlignment.start,
|
||||
// children: [
|
||||
// Expanded(
|
||||
// child: Column(
|
||||
// mainAxisSize: MainAxisSize.min,
|
||||
// crossAxisAlignment: CrossAxisAlignment.start,
|
||||
// children: [
|
||||
// LocaleKeys.markAttendance.tr().toText14(color: Colors.white, isBold: true),
|
||||
// if (model.isTimeRemainingInSeconds == 0) DateTime.now().toString().split(" ")[0].toText12(color: Colors.white),
|
||||
// if (model.isTimeRemainingInSeconds != 0)
|
||||
// Column(
|
||||
// mainAxisSize: MainAxisSize.min,
|
||||
// crossAxisAlignment: CrossAxisAlignment.start,
|
||||
// children: [
|
||||
// 9.height,
|
||||
// Directionality(
|
||||
// textDirection: ui.TextDirection.ltr,
|
||||
// child: CountdownTimer(
|
||||
// endTime: model.endTime,
|
||||
// onEnd: null,
|
||||
// endWidget: "00:00:00".toText14(color: Colors.white, isBold: true),
|
||||
// textStyle: const TextStyle(color: Colors.white, fontSize: 14, letterSpacing: -0.48, fontWeight: FontWeight.bold),
|
||||
// ),
|
||||
// ),
|
||||
// LocaleKeys.timeLeftToday.tr().toText12(color: Colors.white),
|
||||
// 9.height,
|
||||
// ClipRRect(
|
||||
// borderRadius: const BorderRadius.all(Radius.circular(20)),
|
||||
// child: LinearProgressIndicator(
|
||||
// value: model.progress,
|
||||
// minHeight: 8,
|
||||
// valueColor: const AlwaysStoppedAnimation<Color>(Colors.white),
|
||||
// backgroundColor: const Color(0xff196D73),
|
||||
// ),
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// ],
|
||||
// ).paddingOnly(top: 12, right: 15, left: 12),
|
||||
// ),
|
||||
// Row(
|
||||
// children: [
|
||||
// Expanded(
|
||||
// child: Column(
|
||||
// mainAxisSize: MainAxisSize.min,
|
||||
// crossAxisAlignment: CrossAxisAlignment.start,
|
||||
// children: [
|
||||
// LocaleKeys.checkIn.tr().toText12(color: Colors.white),
|
||||
// (model.attendanceTracking!.pSwipeIn == null ? "--:--" : model.attendanceTracking!.pSwipeIn)
|
||||
// .toString()
|
||||
// .toText14(color: Colors.white, isBold: true),
|
||||
// 4.height,
|
||||
// ],
|
||||
// ).paddingOnly(left: 12, right: 12),
|
||||
// ),
|
||||
// Container(
|
||||
// margin: EdgeInsets.only(top: AppState().isArabic(context) ? 6 : 0),
|
||||
// width: 45,
|
||||
// height: 45,
|
||||
// padding: const EdgeInsets.only(left: 10, right: 10),
|
||||
// decoration: BoxDecoration(
|
||||
// color: Color(0xff259EA4),
|
||||
// borderRadius: BorderRadius.only(
|
||||
// bottomRight: AppState().isArabic(context) ? Radius.circular(0) : Radius.circular(15),
|
||||
// bottomLeft: AppState().isArabic(context) ? Radius.circular(15) : Radius.circular(0),
|
||||
// ),
|
||||
// ),
|
||||
// child: SvgPicture.asset(model.isTimeRemainingInSeconds == 0 ? "assets/images/attendance.svg" : "assets/images/attendance.svg"),
|
||||
// ).onPress(() {
|
||||
// showMyBottomSheet(
|
||||
// context,
|
||||
// callBackFunc: () {},
|
||||
// child: MarkAttendanceWidget(model, isFromDashboard: true),
|
||||
// );
|
||||
// }),
|
||||
// ],
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// ).onPress(
|
||||
// () {
|
||||
// Navigator.pushNamed(context, AppRoutes.todayAttendance);
|
||||
// },
|
||||
// ))
|
||||
// .animatedSwither();
|
||||
// },
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// if (env["dashboard"]["attendance"]) 9.width,
|
||||
// Expanded(
|
||||
// child: MenusWidget(),
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// ],
|
||||
// ).paddingOnly(left: 21, right: 21, top: 7),
|
||||
// if (env["marathon"])
|
||||
// context.watch<MarathonProvider>().isLoading
|
||||
// ? const MarathonBannerShimmer().paddingAll(20)
|
||||
// : MarathonBanner(isMarathonUpcoming: context.watch<MarathonProvider>().isUpComingMarathon).paddingAll(20),
|
||||
// ServicesWidget(),
|
||||
// 8.height,
|
||||
// if (env["offersDiscount"])
|
||||
// Container(
|
||||
// width: double.infinity,
|
||||
// padding: const EdgeInsets.only(top: 31),
|
||||
// decoration: BoxDecoration(
|
||||
// color: Colors.white,
|
||||
// borderRadius: const BorderRadius.only(topRight: Radius.circular(50), topLeft: Radius.circular(50)),
|
||||
// border: Border.all(color: MyColors.lightGreyEDColor, width: 1),
|
||||
// ),
|
||||
// child: Column(
|
||||
// mainAxisSize: MainAxisSize.min,
|
||||
// crossAxisAlignment: CrossAxisAlignment.start,
|
||||
// children: [
|
||||
// Row(
|
||||
// crossAxisAlignment: CrossAxisAlignment.center,
|
||||
// children: [
|
||||
// Expanded(
|
||||
// child: Column(
|
||||
// crossAxisAlignment: CrossAxisAlignment.start,
|
||||
// mainAxisSize: MainAxisSize.min,
|
||||
// children: [
|
||||
// LocaleKeys.offers.tr().toText12(),
|
||||
// Row(
|
||||
// children: [
|
||||
// LocaleKeys.discounts.tr().toText24(isBold: true),
|
||||
// 6.width,
|
||||
// Container(
|
||||
// padding: const EdgeInsets.only(left: 8, right: 8),
|
||||
// decoration: BoxDecoration(
|
||||
// color: MyColors.yellowColor,
|
||||
// borderRadius: BorderRadius.circular(10),
|
||||
// ),
|
||||
// child: LocaleKeys.newString.tr().toText10(isBold: true)),
|
||||
// ],
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
// LocaleKeys.viewAllOffers.tr().toText12(isUnderLine: true).onPress(() {
|
||||
// Navigator.pushNamed(context, AppRoutes.offersAndDiscounts);
|
||||
// })
|
||||
// ],
|
||||
// ).paddingOnly(left: 21, right: 21),
|
||||
// Consumer<DashboardProviderModel>(
|
||||
// builder: (BuildContext context, DashboardProviderModel model, Widget? child) {
|
||||
// return SizedBox(
|
||||
// height: 103 + 33,
|
||||
// child: ListView.separated(
|
||||
// shrinkWrap: true,
|
||||
// physics: const BouncingScrollPhysics(),
|
||||
// padding: const EdgeInsets.only(left: 21, right: 21, top: 13),
|
||||
// scrollDirection: Axis.horizontal,
|
||||
// itemBuilder: (BuildContext cxt, int index) {
|
||||
// return model.isOffersLoading
|
||||
// ? const OffersShimmerWidget()
|
||||
// : InkWell(
|
||||
// onTap: () {
|
||||
// navigateToDetails(data.getOffersList[index]);
|
||||
// },
|
||||
// child: SizedBox(
|
||||
// width: 73,
|
||||
// child: Column(
|
||||
// crossAxisAlignment: CrossAxisAlignment.center,
|
||||
// children: [
|
||||
// Container(
|
||||
// width: 73,
|
||||
// height: 73,
|
||||
// decoration: BoxDecoration(
|
||||
// borderRadius: const BorderRadius.all(
|
||||
// Radius.circular(100),
|
||||
// ),
|
||||
// border: Border.all(color: MyColors.lightGreyE3Color, width: 1),
|
||||
// ),
|
||||
// child: ClipRRect(
|
||||
// borderRadius: const BorderRadius.all(
|
||||
// Radius.circular(50),
|
||||
// ),
|
||||
// child: Hero(
|
||||
// tag: "ItemImage" + data.getOffersList[index].rowID!,
|
||||
// transitionOnUserGestures: true,
|
||||
// child: Image.network(
|
||||
// data.getOffersList[index].bannerImage!,
|
||||
// fit: BoxFit.contain,
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// 4.height,
|
||||
// Expanded(
|
||||
// child: AppState().isArabic(context)
|
||||
// ? data.getOffersList[index].titleAR!.toText12(isCenter: true, maxLine: 1)
|
||||
// : data.getOffersList[index].title!.toText12(isCenter: true, maxLine: 1),
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
// );
|
||||
// },
|
||||
// separatorBuilder: (BuildContext cxt, int index) => 8.width,
|
||||
// itemCount: 6),
|
||||
// );
|
||||
// },
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// )
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// )
|
||||
// ],
|
||||
// ),
|
||||
// drawer: SafeArea(
|
||||
// child: AppDrawer(onLanguageChange: _onRefresh),
|
||||
// ),
|
||||
// bottomNavigationBar: !env["bottomBar"]
|
||||
// ? null
|
||||
// : SizedBox(
|
||||
// height: Platform.isAndroid ? 70 : 100,
|
||||
// child: BottomNavigationBar(
|
||||
// items: <BottomNavigationBarItem>[
|
||||
// BottomNavigationBarItem(
|
||||
// icon: SvgPicture.asset(
|
||||
// "assets/icons/home.svg",
|
||||
// color: currentIndex == 0 ? MyColors.grey3AColor : MyColors.grey98Color,
|
||||
// ).paddingAll(4),
|
||||
// label: LocaleKeys.home.tr(),
|
||||
// ),
|
||||
// BottomNavigationBarItem(
|
||||
// icon: SvgPicture.asset(
|
||||
// "assets/icons/create_req.svg",
|
||||
// color: currentIndex == 1 ? MyColors.grey3AColor : MyColors.grey98Color,
|
||||
// ).paddingAll(4),
|
||||
// label: LocaleKeys.createRequest.tr(),
|
||||
// ),
|
||||
// BottomNavigationBarItem(
|
||||
// icon: Stack(
|
||||
// alignment: Alignment.centerLeft,
|
||||
// children: [
|
||||
// SvgPicture.asset(
|
||||
// "assets/icons/work_list.svg",
|
||||
// color: currentIndex == 2 ? MyColors.grey3AColor : MyColors.grey98Color,
|
||||
// ).paddingAll(4),
|
||||
// Consumer<DashboardProviderModel>(
|
||||
// builder: (BuildContext cxt, DashboardProviderModel data, Widget? child) {
|
||||
// if (data.workListCounter == 0) {
|
||||
// return const SizedBox();
|
||||
// }
|
||||
// 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.workListCounter.toString().toText10(color: Colors.white),
|
||||
// ),
|
||||
// );
|
||||
// },
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// label: LocaleKeys.workList.tr(),
|
||||
// ),
|
||||
// BottomNavigationBarItem(
|
||||
// icon: SvgPicture.asset(
|
||||
// "assets/icons/item_for_sale.svg",
|
||||
// color: currentIndex == 3 ? MyColors.grey3AColor : MyColors.grey98Color,
|
||||
// ).paddingAll(4),
|
||||
// label: LocaleKeys.itemsForSale.tr(),
|
||||
// ),
|
||||
// BottomNavigationBarItem(
|
||||
// icon: Stack(
|
||||
// alignment: Alignment.centerLeft,
|
||||
// children: [
|
||||
// SvgPicture.asset(
|
||||
// "assets/icons/chat/chat.svg",
|
||||
// color: currentIndex == 4 ? MyColors.grey3AColor : MyColors.grey98Color,
|
||||
// ).paddingAll(4),
|
||||
// Consumer<ChatProviderModel>(
|
||||
// builder: (BuildContext cxt, ChatProviderModel 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(),
|
||||
// ),
|
||||
// ],
|
||||
// currentIndex: currentIndex,
|
||||
// selectedLabelStyle: const TextStyle(fontSize: 10, color: MyColors.grey3AColor, fontWeight: FontWeight.w600),
|
||||
// unselectedLabelStyle: const TextStyle(fontSize: 10, color: MyColors.grey98Color, fontWeight: FontWeight.w600),
|
||||
// type: BottomNavigationBarType.fixed,
|
||||
// selectedItemColor: MyColors.grey3AColor,
|
||||
// backgroundColor: MyColors.backgroundColor,
|
||||
// selectedIconTheme: const IconThemeData(color: MyColors.grey3AColor, size: 28),
|
||||
// unselectedIconTheme: const IconThemeData(color: MyColors.grey98Color, size: 28),
|
||||
// onTap: (int index) {
|
||||
// if (index == 1) {
|
||||
// Navigator.pushNamed(context, AppRoutes.mowadhafhi);
|
||||
// } else if (index == 2) {
|
||||
// Navigator.pushNamed(context, AppRoutes.workList);
|
||||
// } else if (index == 3) {
|
||||
// Navigator.pushNamed(context, AppRoutes.itemsForSale);
|
||||
// } else if (index == 4) {
|
||||
// Navigator.pushNamed(context, AppRoutes.chat);
|
||||
// }
|
||||
// },
|
||||
// ),
|
||||
// ),
|
||||
// );
|
||||
// }
|
||||
//
|
||||
// void navigateToDetails(OffersListModel offersListModelObj) {
|
||||
// List<OffersListModel> getOffersDetailList = [];
|
||||
// getOffersDetailList.clear();
|
||||
// int counter = 1;
|
||||
//
|
||||
// getOffersDetailList.add(offersListModelObj);
|
||||
//
|
||||
// for (OffersListModel element in data.getOffersList) {
|
||||
// if (counter <= 4) {
|
||||
// if (element.rowID != offersListModelObj.rowID) {
|
||||
// getOffersDetailList.add(element);
|
||||
// counter++;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// Navigator.pushNamed(context, AppRoutes.offersAndDiscountsDetails, arguments: getOffersDetailList);
|
||||
// }
|
||||
// }
|
||||
@ -1,34 +0,0 @@
|
||||
import 'package:easy_localization/easy_localization.dart';
|
||||
import 'package:flutter/material.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/generated/locale_keys.g.dart';
|
||||
import 'package:mohem_flutter_app/widgets/app_bar_widget.dart';
|
||||
|
||||
class HelpScreen extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBarWidget(
|
||||
context,
|
||||
title: LocaleKeys.help.tr(),
|
||||
),
|
||||
backgroundColor: MyColors.backgroundColor,
|
||||
body: Padding(
|
||||
padding: const EdgeInsets.all(20.0),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
(LocaleKeys.dear.tr() + " " + AppState().memberInformationList!.eMPLOYEENAME!).toText18(isBold: true),
|
||||
12.height,
|
||||
LocaleKeys.assistant.tr().toText14(),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -1,298 +0,0 @@
|
||||
import 'package:easy_localization/easy_localization.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_svg/flutter_svg.dart';
|
||||
import 'package:mohem_flutter_app/api/profile_api_client.dart';
|
||||
import 'package:mohem_flutter_app/app_state/app_state.dart';
|
||||
import 'package:mohem_flutter_app/classes/colors.dart';
|
||||
import 'package:mohem_flutter_app/classes/utils.dart';
|
||||
import 'package:mohem_flutter_app/extensions/int_extensions.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/models/hierarchy_lists.dart';
|
||||
import 'package:mohem_flutter_app/widgets/app_bar_widget.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
|
||||
class HierarchyScreen extends StatefulWidget {
|
||||
@override
|
||||
State<HierarchyScreen> createState() => _HierarchyScreenState();
|
||||
}
|
||||
|
||||
class _HierarchyScreenState extends State<HierarchyScreen> {
|
||||
SupervisorHierarchyLists? hierarchyList;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
getData("221142");
|
||||
}
|
||||
|
||||
void getData(String selectedId) async {
|
||||
Utils.showLoading(context);
|
||||
try {
|
||||
hierarchyList = await ProfileApiClient().getHierarchy(selectedId);
|
||||
hierarchyList!.supervisorHierarchyList!.removeWhere((element) => element.lvl == 1);
|
||||
hierarchyList!.supervisorHierarchyList = hierarchyList!.supervisorHierarchyList!.reversed.toList();
|
||||
// hierarchyList!.subordinateHierarchyList!.clear();
|
||||
setState(() {});
|
||||
Utils.hideLoading(context);
|
||||
} catch (ex) {
|
||||
Utils.hideLoading(context);
|
||||
Utils.handleException(ex, context, null);
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBarWidget(
|
||||
context,
|
||||
title: LocaleKeys.profile_personalInformation.tr(),
|
||||
),
|
||||
backgroundColor: MyColors.backgroundColor,
|
||||
body: hierarchyList == null
|
||||
? const Center(child: SizedBox())
|
||||
: SizedBox(
|
||||
height: double.infinity,
|
||||
width: double.infinity,
|
||||
child: SingleChildScrollView(
|
||||
child: Column(
|
||||
children: [
|
||||
ListView.builder(
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
return Row(
|
||||
children: [
|
||||
SizedBox(
|
||||
height: 78 + 12,
|
||||
child: Stack(
|
||||
children: [
|
||||
Align(
|
||||
alignment: (index == 0) ? Alignment.bottomCenter : Alignment.topCenter,
|
||||
child: SizedBox(
|
||||
// height: index == 0
|
||||
// ? 40 + 6
|
||||
// : (index == hierarchyList!.supervisorHierarchyList!.length - 1)
|
||||
// ? 40 + 6
|
||||
// : 78 + 6,
|
||||
height: index == 0
|
||||
? 40 + 6
|
||||
: (index == hierarchyList!.supervisorHierarchyList!.length - 1)
|
||||
? 40 + 6
|
||||
: 78 + 6 + 6,
|
||||
child: Container(
|
||||
height: double.infinity,
|
||||
color: Colors.black,
|
||||
width: 2,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
width: 16,
|
||||
child: Divider(
|
||||
color: Colors.black,
|
||||
thickness: 2,
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: Container(
|
||||
width: double.infinity,
|
||||
padding: const EdgeInsets.all(12),
|
||||
margin: const EdgeInsets.only(top: 12),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: const BorderRadius.all(Radius.circular(12)),
|
||||
border: Border.all(color: MyColors.lightGreyEDColor, width: 1),
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
hierarchyList?.supervisorHierarchyList![index].employeeImage == null
|
||||
? SvgPicture.asset(
|
||||
"assets/images/user.svg",
|
||||
height: 52,
|
||||
width: 52,
|
||||
)
|
||||
: CircleAvatar(
|
||||
radius: 52 / 2,
|
||||
backgroundImage: MemoryImage(Utils.dataFromBase64String(hierarchyList?.supervisorHierarchyList![index].employeeImage)),
|
||||
backgroundColor: Colors.black,
|
||||
),
|
||||
12.width,
|
||||
Expanded(
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
hierarchyList!.supervisorHierarchyList![index].employeeName.toString().toText14(isBold: true, maxlines: 1),
|
||||
hierarchyList!.supervisorHierarchyList![index].positionName.toString().toText12(isBold: false, maxLine: 1),
|
||||
],
|
||||
),
|
||||
),
|
||||
IconButton(
|
||||
onPressed: () {
|
||||
launch("tel://${hierarchyList!.supervisorHierarchyList![index].employeeMobileNumber}");
|
||||
},
|
||||
icon: Icon(
|
||||
Icons.phone,
|
||||
color: MyColors.gradiantEndColor,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
itemCount: hierarchyList?.supervisorHierarchyList?.length ?? 0,
|
||||
padding: const EdgeInsets.only(left: 12, right: 12, top: 12),
|
||||
physics: const NeverScrollableScrollPhysics(),
|
||||
shrinkWrap: true,
|
||||
),
|
||||
ListView.builder(
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
return InkWell(
|
||||
onTap: (hierarchyList!.subordinateHierarchyList![index].numOfSubordinates == 0)
|
||||
? null
|
||||
: () {
|
||||
getData(hierarchyList!.subordinateHierarchyList![index].employeeNumber.toString());
|
||||
},
|
||||
child: Padding(
|
||||
padding: EdgeInsets.only(
|
||||
left: AppState().isArabic(context)
|
||||
? 0
|
||||
: index == 0
|
||||
? 28
|
||||
: 58,
|
||||
right: !AppState().isArabic(context)
|
||||
? 0
|
||||
: index == 0
|
||||
? 28
|
||||
: 58),
|
||||
child: Row(
|
||||
children: [
|
||||
SizedBox(
|
||||
height: 78 + 12,
|
||||
child: Stack(
|
||||
children: [
|
||||
Align(
|
||||
alignment: (index == 0) ? Alignment.topCenter : Alignment.topCenter,
|
||||
child: SizedBox(
|
||||
height: index == 0
|
||||
? 40 + 6
|
||||
: (index == hierarchyList!.subordinateHierarchyList!.length - 1)
|
||||
? 40 + 6
|
||||
: 78 + 6 + 6,
|
||||
child: Container(
|
||||
height: double.infinity,
|
||||
color: Colors.black,
|
||||
width: 2,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
width: 18,
|
||||
child: Divider(
|
||||
color: Colors.black,
|
||||
thickness: 2,
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: Container(
|
||||
width: double.infinity,
|
||||
padding: const EdgeInsets.all(12),
|
||||
margin: const EdgeInsets.only(top: 12),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: const BorderRadius.all(Radius.circular(12)),
|
||||
border: Border.all(color: MyColors.lightGreyEDColor, width: 1),
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
hierarchyList?.subordinateHierarchyList![index].employeeImage == null
|
||||
? SvgPicture.asset(
|
||||
"assets/images/user.svg",
|
||||
height: 52,
|
||||
width: 52,
|
||||
)
|
||||
: CircleAvatar(
|
||||
radius: 52 / 2,
|
||||
backgroundImage: MemoryImage(Utils.dataFromBase64String(hierarchyList?.subordinateHierarchyList![index].employeeImage)),
|
||||
backgroundColor: Colors.black,
|
||||
),
|
||||
12.width,
|
||||
Expanded(
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
hierarchyList!.subordinateHierarchyList![index].employeeName.toString().toText14(isBold: true, maxlines: 1),
|
||||
hierarchyList!.subordinateHierarchyList![index].positionName.toString().toText12(isBold: false, maxLine: 1),
|
||||
],
|
||||
),
|
||||
),
|
||||
8.width,
|
||||
Column(
|
||||
children: [
|
||||
InkWell(
|
||||
onTap: () {
|
||||
launch("tel://${hierarchyList!.subordinateHierarchyList![index].employeeMobileNumber}");
|
||||
},
|
||||
child: const Padding(
|
||||
padding: EdgeInsets.only(bottom: 10),
|
||||
child: Icon(
|
||||
Icons.phone,
|
||||
color: MyColors.gradiantEndColor,
|
||||
),
|
||||
),
|
||||
),
|
||||
if (hierarchyList!.subordinateHierarchyList![index].numOfSubordinates != 0)
|
||||
Container(
|
||||
decoration: const BoxDecoration(
|
||||
color: MyColors.gradiantEndColor,
|
||||
borderRadius: BorderRadius.all(Radius.circular(12)),
|
||||
),
|
||||
width: 18,
|
||||
height: 18,
|
||||
alignment: Alignment.center,
|
||||
child: hierarchyList!.subordinateHierarchyList![index].numOfSubordinates.toString().toTextAuto(isBold: true, color: Colors.white, fontSize: 10),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
itemCount: hierarchyList?.subordinateHierarchyList?.length ?? 0,
|
||||
padding: const EdgeInsets.only(left: 12, right: 12, bottom: 12),
|
||||
physics: const NeverScrollableScrollPhysics(),
|
||||
shrinkWrap: true,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||