"lib/screens/old/crmDashboardold.dart" did not exist on "233faa105374495a0b093f8b6ec22ba6d15bc6c7"
Commit dddda326 authored by Sai Srinivas's avatar Sai Srinivas
Browse files

09-07-2025 By Sai Srinivas

New UI Changes Home, Finance , crm , service, attendance
parent c92f4c79
<svg width="40" height="40" viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg">
<circle cx="20" cy="20" r="20" fill="white"/>
<path d="M19.6586 30.9281C19.8785 31.0238 20.1297 31.0238 20.3496 30.9281C22.9512 29.7953 28.2883 24.3922 28.2883 19.2797C28.2883 14.707 24.5812 11 20.0086 11H19.991C15.418 11 11.7109 14.707 11.7109 19.2797C11.7109 24.3926 17.0562 29.7957 19.6582 30.9281H19.6586ZM19.9508 14.6891C21.2449 14.6891 22.2941 15.7383 22.2941 17.0324C22.2941 18.3266 21.2449 19.3758 19.9508 19.3758C18.6566 19.3758 17.6074 18.3266 17.6074 17.0324C17.6074 15.7383 18.6566 14.6891 19.9508 14.6891ZM16.1293 22.6875C16.0875 22.2809 16.1059 21.9387 16.1059 21.9383C16.1059 21.9383 16.0875 21.7176 16.1293 21.3176C16.1293 21.3141 16.1301 21.3109 16.1305 21.3074C16.1648 20.9793 16.3125 20.6738 16.5469 20.4391C16.7812 20.2051 17.0918 20.0531 17.4219 20.0176C17.9066 19.9664 19.3812 19.9383 20.1309 19.9383C20.8805 19.9383 22.0836 19.966 22.5684 20.0176C22.898 20.0527 23.209 20.2051 23.4434 20.4391C23.6777 20.6738 23.8254 20.9793 23.8598 21.3074C23.8598 21.3109 23.8605 21.3141 23.8609 21.3176C23.9027 21.718 23.8973 21.9375 23.8973 21.9379C23.8973 21.9379 23.9027 22.2813 23.8613 22.6883C23.8613 22.6918 23.8605 22.6949 23.8602 22.6984C23.8258 23.032 23.6789 23.3613 23.4453 23.6285C23.2121 23.8953 22.9023 24.0867 22.573 24.1562C22.0895 24.2656 20.884 24.3734 20.1316 24.3684C19.3793 24.3871 17.9012 24.2703 17.4176 24.1555C17.0883 24.0859 16.7785 23.8945 16.5453 23.6277C16.3121 23.3605 16.1648 23.0313 16.1305 22.698C16.1305 22.6945 16.1297 22.691 16.1293 22.6879V22.6875Z" fill="url(#paint0_linear_106_719)"/>
<defs>
<linearGradient id="paint0_linear_106_719" x1="11.7198" y1="20.888" x2="34.4129" y2="31.1599" gradientUnits="userSpaceOnUse">
<stop stop-color="#CE7138"/>
<stop offset="1" stop-color="#91481B"/>
</linearGradient>
</defs>
</svg>
......@@ -77,6 +77,7 @@ class Generatordetailsprovider extends ChangeNotifier {
ComplaintDescriptionList? _selectedDescriptionType;
List<ContactList> get contactsList => _contactList;
List<ScheduleList> get scheduleList => _scheduleList;
File? get image => _image;
......@@ -114,7 +115,9 @@ class Generatordetailsprovider extends ChangeNotifier {
String? _selectedDescriptionId;
bool get submitLoading => _submitLoading;
bool get showMoreScheduleDetails => _showMoreScheduleDetails;
bool get showMoreScheduleList => _showMoreScheduleList;
List<ComplaintTypeList> get complaintTypeDropdown => _complaintTypeDropdown;
......@@ -218,6 +221,7 @@ class Generatordetailsprovider extends ChangeNotifier {
_showMoreScheduleList = value;
notifyListeners();
}
set showMoreScheduleDetails(bool value) {
_showMoreScheduleDetails = value;
notifyListeners();
......@@ -289,7 +293,11 @@ class Generatordetailsprovider extends ChangeNotifier {
_selectedDescriptionId = "";
_selectedDescription = "";
_qrViewController!.dispose();
_imageName = null;
_image = null;
_imagePicked = 0;
_imageError = null;
notifyListeners();
}
initialFunction(from) async {
......@@ -543,8 +551,8 @@ class Generatordetailsprovider extends ChangeNotifier {
_cmsngDate = data.cmsngDate;
_status = data.status;
_genLocation = data.loc;
_contactList = data.contactList??[];
_scheduleList = data.scheduleList??[];
_contactList = data.contactList ?? [];
_scheduleList = data.scheduleList ?? [];
_complaintTypeDropdown = data.complaintTypeList ?? [];
_complaintCategorydropdown = data.complaintCategoryList ?? [];
_complaintDescriptionDropdown = data.complaintDescriptionList ?? [];
......@@ -795,7 +803,7 @@ class Generatordetailsprovider extends ChangeNotifier {
]) async {
_submitLoading = true;
notifyListeners();
if (!valid()) {
if (!valid(context)) {
return;
}
try {
......@@ -855,11 +863,19 @@ class Generatordetailsprovider extends ChangeNotifier {
}
}
bool valid() {
bool valid(context) {
bool isValid = true;
if (_image == null || _imagePicked == 0) {
_imageError = "Please Add Proof";
notifyListeners();
isValid = false;
// notifyListeners();
}
if (latlongs.isEmpty) {
toast(
context,
"Error in Location, Please Check your location and Try again",
);
isValid = false;
}
notifyListeners();
return isValid;
......@@ -944,6 +960,67 @@ class Generatordetailsprovider extends ChangeNotifier {
}
}
Future<void> TagGeneratorCheckAPIFunction(
homeProvider,
BuildContext context,
genID,
) async {
try {
_submitLoading = true;
notifyListeners();
final data = await ApiCalling.TagGeneratorCheckAPI(
homeProvider.empId,
homeProvider.session,
genID,
);
if (data != null) {
if (data.sessionExists == 1) {
if (data.error == 0) {
_submitLoading = false;
Navigator.pop(context);
showTagGeneratorBottomSheet(context, genID);
notifyListeners();
_isLoading = false;
} else if (data.error == 1) {
_submitLoading = false;
notifyListeners();
toast(context, data.message);
} else if (data.error == 2) {
_submitLoading = false;
notifyListeners();
toast(context, data.message);
} else {
_isLoading = true;
_submitLoading = false;
notifyListeners();
print("error");
}
} else {
_isLoading = true;
_submitLoading = false;
notifyListeners();
// SharedpreferencesService().clearPreferences();
// toast(context, "Your Session expired, Please Login Again!");
// Navigator.push(
// context,
// MaterialPageRoute(builder: (context) => Splash()),
// );
}
} else {
_isLoading = true;
_submitLoading = false;
notifyListeners();
toast(context, "Something Went Wrong, Please try again!");
print("error2");
}
} on Error catch (e) {
_submitLoading = false;
notifyListeners();
print(e.toString());
}
}
imgFromCamera() async {
// Capture a photo
try {
......
......@@ -25,15 +25,25 @@ class HomescreenNotifier extends ChangeNotifier {
String? _onlineStatus = "Offline";
String get username => _username;
String get email => _email;
String get curdate => _curdate;
String get empId => _empId;
String get session => _session;
String get webPageUrl => _webPageUrl;
String get whizzdomPageUrl => _whizzdomPageUrl;
String get roleStatus => _roleStatus;
int get att_status => _att_status;
get Sessionid => _Sessionid;
String? get onlineStatus => _onlineStatus;
WebSocketManager webSocketManager = WebSocketManager(
......
......@@ -9,63 +9,88 @@ import '../../Models/crmModels/crmUniversalSearchResponse.dart';
import '../../services/api_calling.dart';
import '../HomeScreenNotifier.dart';
class Crmdashboardprovider extends ChangeNotifier{
class Crmdashboardprovider extends ChangeNotifier {
TextEditingController searchController = TextEditingController();
List<PagesAccessible> _accessPages = [];
List<PagesAccessible> get accessPages => _accessPages;
List<PendingTasks> _pendingTasks = [];
List<PendingTasks> get pendingTasksLists => _pendingTasks;
List<Accounts> _accountsList = [];
List<Leads> _leadsList = [];
List<Enquires> _enquiresList = [];
List<Accounts> get accountsList => _accountsList;
List<Leads> get leadsList => _leadsList;
List<Enquires> get enquiresList => _enquiresList;
Hotleads _hotleads = Hotleads();
Hotleads get hotleads => _hotleads;
Hotleads _coldleads = Hotleads();
Hotleads get coldleads => _coldleads;
Hotleads _warmleads = Hotleads();
Hotleads get warmleads => _warmleads;
Hotleads _totalleads = Hotleads();
Hotleads get totalleads => _totalleads;
Hotleads _orderlost = Hotleads();
Hotleads get orderlost => _orderlost;
Hotleads _norequirement = Hotleads();
Hotleads get norequirement => _norequirement;
Hotleads _openEnquiries = Hotleads();
Hotleads get openEnquiries => _openEnquiries;
List<Hotleads> _allLeads = [];
List<Hotleads> get allLeads => _allLeads;
Future<void>accessPagesAPIFunction(context) async {
try{
var HomeProv = Provider.of<HomescreenNotifier>(context,listen: false);
final data = await ApiCalling.crmAccessiblePagesAPI(HomeProv.empId, HomeProv.session);
if(data!=null){
if(data.error=="0"){
Future<void> accessPagesAPIFunction(context) async {
try {
var HomeProv = Provider.of<HomescreenNotifier>(context, listen: false);
final data = await ApiCalling.crmAccessiblePagesAPI(
HomeProv.empId,
HomeProv.session,
);
if (data != null) {
if (data.error == "0") {
_accessPages = data.pagesAccessible!;
_accessPages.add(PagesAccessible(mode: "",id: 0,pageName: "Nearby Leads"));
_accessPages.add(
PagesAccessible(mode: "", id: 0, pageName: "Nearby Leads"),
);
notifyListeners();
}
}
}catch (e,s){
}
} catch (e, s) {}
}
Future<void> crmDashboardAPIFunction(context, mode,
from,to,teamemployee) async {
try{
var HomeProv = Provider.of<HomescreenNotifier>(context,listen: false);
final data = await ApiCalling.crmDashboardAPI(HomeProv.empId, HomeProv.session, mode,
from,to,teamemployee);
if(data!=null){
if(data.error=="0"){
Future<void> crmDashboardAPIFunction(
context,
mode,
from,
to,
teamemployee,
) async {
try {
var HomeProv = Provider.of<HomescreenNotifier>(context, listen: false);
final data = await ApiCalling.crmDashboardAPI(
HomeProv.empId,
HomeProv.session,
mode,
from,
to,
teamemployee,
);
if (data != null) {
if (data.error == "0") {
_hotleads = data.hotleads!;
_coldleads = data.coldleads!;
_warmleads = data.warmleads!;
......@@ -85,45 +110,41 @@ class Crmdashboardprovider extends ChangeNotifier{
notifyListeners();
}
}
}catch (e,s){
}
} catch (e, s) {}
}
Future<void> crmPendingTasksAPIFunction(context) async {
try{
var HomeProv = Provider.of<HomescreenNotifier>(context,listen: false);
final data = await ApiCalling.crmPendingTasksAPI(HomeProv.empId, HomeProv.session);
if(data!=null){
if(data.error=="0"){
Future<void> crmPendingTasksAPIFunction(context) async {
try {
var HomeProv = Provider.of<HomescreenNotifier>(context, listen: false);
final data = await ApiCalling.crmPendingTasksAPI(
HomeProv.empId,
HomeProv.session,
);
if (data != null) {
if (data.error == "0") {
_pendingTasks = data.pendingTasks!;
notifyListeners();
}
}
}catch (e,s){
}
} catch (e, s) {}
}
Future<void> crmUniversalSearchFunction(context) async {
try{
var HomeProv = Provider.of<HomescreenNotifier>(context,listen: false);
final data = await ApiCalling.crmUniversalSearchAPI(HomeProv.empId, HomeProv.session,searchController.text);
if(data!=null){
if(data.error=="0"){
_accountsList = data.accounts??[];
_leadsList = data.leads??[];
_enquiresList = data.enquires??[];
Future<void> crmUniversalSearchFunction(context) async {
try {
var HomeProv = Provider.of<HomescreenNotifier>(context, listen: false);
final data = await ApiCalling.crmUniversalSearchAPI(
HomeProv.empId,
HomeProv.session,
searchController.text,
);
if (data != null) {
if (data.error == "0") {
_accountsList = data.accounts ?? [];
_leadsList = data.leads ?? [];
_enquiresList = data.enquires ?? [];
notifyListeners();
}
}
}catch (e,s){
}
} catch (e, s) {}
}
}
\ No newline at end of file
}
......@@ -12,7 +12,8 @@ class AppColors {
static Color cyan_blue = Color(0xFF219EBC);
static Color profile_card_gradient1 = Color(0xFFCFEEFF);
static Color profile_card_gradient2 = Color(0xFF97D9FF);
static Color scaffold_bg_color = Color(0xFFF0F4F5);
static Color profile_card = Color(0xFFDBF2FF);
static Color scaffold_bg_color = Color(0xFFF6F6F8);
static Color button_disabled = Color(0xFFBEE5FB);
static Color text_field_color = Color(0xFFF0F4F5);
static Color overlay_box_color = Color(0xFFE6F6FF);
......
......@@ -42,6 +42,43 @@ PreferredSizeWidget appbar(BuildContext context, title) {
);
}
PreferredSizeWidget appbarNew(BuildContext context, title,int color) {
return AppBar(
backgroundColor: Color(color),
automaticallyImplyLeading: false,
title: SizedBox(
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
InkResponse(
onTap: () => Navigator.pop(context, true),
child: SvgPicture.asset("assets/svg/appbar_back_button.svg", height: 25),
),
SizedBox(width: 10,),
InkResponse(
onTap: () => Navigator.pop(context, true),
child: Text(
title,
style: TextStyle(
fontSize: 16,
height: 1.1,
fontFamily: "JakartaSemiBold",
color: AppColors.semi_black,
),
),
),
],
),
),
// shape: RoundedRectangleBorder(
// borderRadius: BorderRadius.vertical(
// bottom: Radius.circular(30), // Adjust the radius as needed
// ),
// ),
);
}
PreferredSizeWidget appbar2(BuildContext context, title, reset, widget) {
return AppBar(
automaticallyImplyLeading: false,
......@@ -91,6 +128,56 @@ PreferredSizeWidget appbar2(BuildContext context, title, reset, widget) {
);
}
PreferredSizeWidget appbar2New(BuildContext context, title, reset, widget,int color) {
return AppBar(
backgroundColor: Color(color),
automaticallyImplyLeading: false,
elevation: 2.0,
title: SizedBox(
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
InkResponse(
onTap: () {
reset();
Navigator.pop(context, true);
},
child: SvgPicture.asset("assets/svg/app_bar_back.svg", height: 25),
),
Expanded(
flex: 4,
child: InkResponse(
onTap: () {
reset();
Navigator.pop(context, true);
},
child: Text(
title,
overflow: TextOverflow.ellipsis,
maxLines: 1,
style: TextStyle(
fontSize: 16,
height: 1.1,
fontFamily: "JakartaSemiBold",
color: AppColors.semi_black,
),
),
),
),
Spacer(),
widget,
],
),
),
// shape: RoundedRectangleBorder(
// borderRadius: BorderRadius.vertical(
// bottom: Radius.circular(30), // Adjust the radius as needed
// ),
// ),
);
}
Future<bool> onBackPressed(BuildContext context) async {
Navigator.pop(context, true);
return true;
......
......@@ -30,7 +30,6 @@ class _AttendanceScreenState extends State<AttendanceScreen> {
super.initState();
_connectivity.initialise();
_connectivity.myStream.listen((source) {
setState(() => _source = source);
});
homeProvider = Provider.of<HomescreenNotifier>(context, listen: false);
......@@ -41,7 +40,6 @@ class _AttendanceScreenState extends State<AttendanceScreen> {
});
}
@override
void dispose() {
// TODO: implement dispose
......@@ -64,11 +62,16 @@ class _AttendanceScreenState extends State<AttendanceScreen> {
}
return (connection == 'Online')
? Platform.isAndroid
? WillPopScope(
onWillPop: () => onBackPressed(context),
child: SafeArea(top: false, bottom: true, child: _scaffold(context)),
)
: _scaffold(context):NoNetwork(context);
? WillPopScope(
onWillPop: () => onBackPressed(context),
child: SafeArea(
top: false,
bottom: true,
child: _scaffold(context),
),
)
: _scaffold(context)
: NoNetwork(context);
}
Widget _scaffold(BuildContext context) {
......@@ -144,17 +147,18 @@ class _AttendanceScreenState extends State<AttendanceScreen> {
child: Scaffold(
resizeToAvoidBottomInset: true,
backgroundColor: AppColors.scaffold_bg_color,
appBar: appbar(context, "Attendance"),
appBar: appbarNew(context, "Attendance", 0xFFFFFFFF),
body: Container(
child: SingleChildScrollView(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
margin: EdgeInsets.only(top: 15, bottom: 15),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(16),
borderRadius: BorderRadius.vertical(
bottom: Radius.circular(20),
),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
......@@ -166,16 +170,36 @@ class _AttendanceScreenState extends State<AttendanceScreen> {
top: 15,
),
child: Row(
children: [
Expanded(child: Text("Check-in")),
Expanded(child: Text("Check-out")),
],
children: List.generate(2, (j) {
final heads = ["Check-in", "Check-out"];
return Expanded(
child: Text(
"Check-in",
style: TextStyle(
color: AppColors.grey_thick,
fontSize: 14,
fontFamily: "JakartaMedium",
),
),
);
}),
),
),
SizedBox(
child: Row(
children: [
Expanded(
children: List.generate(2, (iii) {
final times = [formattedTime, formattedTime2];
final periods = [period, period2];
final locations = [
attendance
.attendanceHistory
.first['check_in_location'].toString()??"-",
attendance
.attendanceHistory
.first['check_out_location'].toString()??"-",
];
return Expanded(
child: Container(
padding: EdgeInsets.symmetric(
horizontal: 10,
......@@ -183,11 +207,11 @@ class _AttendanceScreenState extends State<AttendanceScreen> {
),
margin: EdgeInsets.symmetric(
horizontal: 10,
vertical: 15,
vertical: 5,
),
decoration: BoxDecoration(
color: Color(0xFFF3EDFF),
borderRadius: BorderRadius.circular(16),
borderRadius: BorderRadius.circular(20),
),
child: Column(
crossAxisAlignment:
......@@ -197,191 +221,164 @@ class _AttendanceScreenState extends State<AttendanceScreen> {
text: TextSpan(
children: [
TextSpan(
text: formattedTime,
text: times[iii],
style: TextStyle(
color:
formattedTime != "-"
? Color(0xFF493272)
times[iii] != "-"
? Color(0xFF1286C7)
: Color(0xFFED3424),
fontFamily: "JakartaRegular",
fontSize: 30,
fontSize: 20,
),
),
TextSpan(
text: period,
text: periods[iii],
style: TextStyle(
color:
period != "-"
? Color(0xFF493272)
periods[iii] != "-"
? Color(0xFF1286C7)
: Color(0xFFED3424),
fontFamily: "JakartaRegular",
fontSize: 14,
),
),
],
),
),
SizedBox(height: 10),
Text(
"${attendance.attendanceHistory.firstOrNull?['check_in_location']}",
locations[iii],
style: TextStyle(
color: Color(0xFF818181),
color: AppColors.semi_black,
fontSize: 12,
),
),
],
),
),
),
Expanded(
child: Container(
padding: EdgeInsets.symmetric(
horizontal: 10,
vertical: 15,
),
margin: EdgeInsets.symmetric(
horizontal: 10,
vertical: 15,
),
decoration: BoxDecoration(
color: Color(0xFFF3EDFF),
borderRadius: BorderRadius.circular(16),
),
child: Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
RichText(
text: TextSpan(
children: [
TextSpan(
text: formattedTime2,
style: TextStyle(
color:
formattedTime2 != "-"
? Color(0xFF493272)
: Color(0xFFED3424),
fontFamily: "JakartaRegular",
fontSize: 30,
),
),
TextSpan(
text: period2,
style: TextStyle(
color:
period2 != "-"
? Color(0xFF493272)
: Color(0xFFED3424),
fontFamily: "JakartaRegular",
),
);
}),
),
),
Container(
padding: EdgeInsets.only(left: 10, top: 10),
child: Text(
"Attendance Details",
style: TextStyle(
fontFamily: "JakartaMedium",
fontSize: 14,
color: Color(0xFF818181),
),
),
),
Container(
padding: EdgeInsets.symmetric(
horizontal: 10,
vertical: 10,
),
child: GridView.builder(
itemCount: 4,
shrinkWrap: true,
physics: NeverScrollableScrollPhysics(),
gridDelegate:
SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 2,
crossAxisSpacing: 10,
mainAxisSpacing: 10,
childAspectRatio: 20 / 10,
),
itemBuilder: (context, index) {
final numbers = [
attendance.presentDays,
attendance.absentDays,
attendance.holidays,
attendance.latePenalties,
];
final names = [
"Present \nDays",
"Absent \nDays",
"Holidays",
"Late \nPoints",
];
final colors = [
0xFFE7FFE5,
0xFFFFEFEF,
0xFFF3EDFF,
0xFFFFF6F0,
];
final textcolors = [
0xFF0D9C00,
0xFFFF0000,
0xFF493272,
0xFF91481B,
];
final assetNames = [
"assets/svg/attendance/present_ic.svg",
"assets/svg/attendance/absent_ic.svg",
"assets/svg/attendance/holidays_ic.svg",
"assets/svg/attendance/penalty_ic.svg",
];
return Container(
padding: EdgeInsets.symmetric(horizontal: 13),
decoration: BoxDecoration(
color: Color(colors[index]),
borderRadius: BorderRadius.circular(20),
),
child: Column(
crossAxisAlignment:
CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
numbers[index].toString(),
style: TextStyle(
fontSize: 20,
fontFamily: "JakartaMedium",
color: Color(textcolors[index]),
),
),
Row(
children: [
Expanded(
flex: 4,
child: Text(
names[index],
style: TextStyle(
fontSize: 14,
fontFamily: "JakartaRegular",
color: AppColors.semi_black,
),
],
),
),
),
Text(
"${attendance.attendanceHistory.firstOrNull?['check_out_location']}",
style: TextStyle(
color: Color(0xFF818181),
Expanded(
flex: 1,
child: SvgPicture.asset(
assetNames[index],
),
),
),
],
),
],
),
],
),
),
],
);
},
),
),
],
),
),
Container(
padding: EdgeInsets.symmetric(
horizontal: 10,
vertical: 10,
),
child: Text(
"Attendance Details",
style: TextStyle(
fontFamily: "JakartaSemiBold",
fontSize: 14,
color: Color(0xFF818181),
),
),
),
Container(
padding: EdgeInsets.symmetric(
horizontal: 10,
vertical: 10,
),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(16),
),
child: GridView.builder(
itemCount: 4,
shrinkWrap: true,
physics: NeverScrollableScrollPhysics(),
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 2,
crossAxisSpacing: 10,
mainAxisSpacing: 10,
childAspectRatio: 20 / 10,
),
itemBuilder: (context, index) {
final numbers = [
attendance.presentDays,
attendance.absentDays,
attendance.holidays,
attendance.latePenalties,
];
final names = [
"Present Days",
"Absent Days",
"Holidays",
"Late Points",
];
final colors = [
0xFFE7FFE5,
0xFFFFEFEF,
0xFFF3EDFF,
0xFFFFF6F0,
];
final textcolors = [
0xFF0D9C00,
0xFFFF0000,
0xFF493272,
0xFF91481B,
];
return Container(
padding: EdgeInsets.symmetric(horizontal: 13),
decoration: BoxDecoration(
color: Color(colors[index]),
borderRadius: BorderRadius.circular(12),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
numbers[index].toString(),
style: TextStyle(
fontSize: 30,
fontFamily: "JakartaMedium",
color: Color(textcolors[index]),
),
),
Text(
names[index],
style: TextStyle(color: Color(0xFF818181)),
),
],
),
);
},
),
),
SizedBox(height: 15),
///calendar
Container(
// padding: EdgeInsets.symmetric(horizontal: 10,vertical: 5),
margin: EdgeInsets.symmetric(horizontal: 10, vertical: 5),
margin: EdgeInsets.symmetric(
horizontal: 15,
vertical: 10,
),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(16),
color: Colors.white,
......@@ -612,7 +609,7 @@ class _AttendanceScreenState extends State<AttendanceScreen> {
? Color(0xFFFFFFFF)
: dateColor == 'g'
? Color(
0xFF6B3A02,
0xFFE7FFE5,
).withAlpha(50)
: dateColor == 'r'
? Color(
......@@ -643,7 +640,7 @@ class _AttendanceScreenState extends State<AttendanceScreen> {
index))
? Color(0xFF2D2D2D)
: dateColor == 'g'
? Color(0xFF6B3A02)
? Color(0xFF0D9C00)
: dateColor == 'r'
? Color(0xFFFF0000)
: dateColor == 'b'
......@@ -670,61 +667,69 @@ class _AttendanceScreenState extends State<AttendanceScreen> {
],
),
),
SizedBox(height: 70),
SizedBox(height: 25),
],
),
),
),
floatingActionButton:
bottomNavigationBar:
attendance.attendanceStatus == 0 ||
attendance.attendanceStatus == 1
? Align(
alignment: Alignment.bottomCenter,
child: InkWell(
onTap: () async {
var res = await Navigator.push(
context,
MaterialPageRoute(
builder:
(context) => CheckInOutScreen(
getAttendanceStatus:
attendance.attendanceStatus,
),
),
);
if (res == true) {
attendance.getAttendanceList(homeProvider, context);
attendance.init(homeProvider, context);
attendance.loadAttendanceDetails(
homeProvider,
? Container(
height: 75,
decoration: BoxDecoration(color: Colors.white),
padding: EdgeInsets.symmetric(vertical: 10),
child: Align(
alignment: Alignment.center,
child: InkWell(
onTap: () async {
var res = await Navigator.push(
context,
MaterialPageRoute(
builder:
(context) => CheckInOutScreen(
getAttendanceStatus:
attendance.attendanceStatus,
),
),
);
}
var f = FocusScope.of(context);
if (!f.hasPrimaryFocus) {
f.unfocus();
}
},
child: Container(
alignment: Alignment.bottomCenter,
height: 45,
margin: EdgeInsets.symmetric(horizontal: 10),
width: MediaQuery.of(context).size.width,
decoration: BoxDecoration(
color: AppColors.app_blue,
borderRadius: BorderRadius.circular(15.0),
),
child: Center(
child: Text(
attendance.attendanceStatus == 0
? "Check In"
: "Check Out",
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 16,
color: Colors.white,
fontFamily: "JakartaMedium",
if (res == true) {
attendance.getAttendanceList(
homeProvider,
context,
);
attendance.init(homeProvider, context);
attendance.loadAttendanceDetails(
homeProvider,
context,
);
}
var f = FocusScope.of(context);
if (!f.hasPrimaryFocus) {
f.unfocus();
}
},
child: Container(
alignment: Alignment.bottomCenter,
height: 45,
margin: EdgeInsets.symmetric(horizontal: 10),
width: MediaQuery.of(context).size.width,
decoration: BoxDecoration(
color: AppColors.app_blue,
borderRadius: BorderRadius.circular(15.0),
),
child: Center(
child: Text(
attendance.attendanceStatus == 0
? "Check In"
: "Check Out",
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 16,
color: Colors.white,
fontFamily: "JakartaMedium",
),
),
),
),
......@@ -796,14 +801,14 @@ class _AttendanceScreenState extends State<AttendanceScreen> {
itemBuilder: (context, index) {
final colors = [
Color(0xFF493272).withAlpha(50),
Color(0xFF6B3A02).withAlpha(50),
Color(0xFFE7FFE5),
Color(0xFFFF0000).withAlpha(50),
Color(0xFFFFE8D0),
Color(0xFFFFF9B2),
];
final text_colors = [
Color(0xFF493272),
Color(0xFF6B3A02),
Color(0xFF0D9C00),
Color(0xFFFF0000),
Color(0xFF6B3A02),
Color(0xFF605C00),
......
......@@ -345,7 +345,7 @@ class _WebErpScreenState extends State<WebErpScreen> {
print(uri);
print(uri.scheme);
if (uri.toString().contains(
'file_viewer_n ame.php',
'file_viewer_name.php',
) &&
uri.toString().contains('.pdf')) {
final pdfPath =
......
......@@ -19,12 +19,14 @@ class Universalsearchscreen extends StatefulWidget {
}
class _UniversalsearchscreenState extends State<Universalsearchscreen> {
FocusNode focusNode = FocusNode();
@override
void initState() {
super.initState();
WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
var prov = Provider.of<Crmdashboardprovider>(context, listen: false);
prov.crmUniversalSearchFunction(context);
// prov.crmUniversalSearchFunction(context);
});
}
......@@ -36,24 +38,131 @@ class _UniversalsearchscreenState extends State<Universalsearchscreen> {
onWillPop: () => onBackPressed(context),
child: SafeArea(
top: false,
bottom: Platform.isIOS?false:true,
bottom: Platform.isIOS ? false : true,
child: Scaffold(
resizeToAvoidBottomInset: true,
backgroundColor: AppColors.scaffold_bg_color,
appBar: appbar(context, "Search"),
appBar: appbarNew(context, "Search", 0xFFFFFFFF),
body: SingleChildScrollView(
child: Column(
children: [
Container(
padding: const EdgeInsets.fromLTRB(5.0, 0.0, 10, 0),
// margin: const EdgeInsets.fromLTRB(10.0, 0.0, 10, 10),
height: 50,
alignment: Alignment.center,
decoration: BoxDecoration(
color: AppColors.white,
borderRadius: BorderRadius.vertical(
bottom: Radius.circular(14),
),
),
child: Row(
children: [
Expanded(
child: Container(
padding: const EdgeInsets.fromLTRB(
0.0,
0.0,
10,
0,
),
margin: const EdgeInsets.fromLTRB(
10.0,
0.0,
10,
10,
),
child: TextFormField(
controller: provider.searchController,
keyboardType: TextInputType.text,
maxLines: 1,
onChanged: (value) {
Future.delayed(
Duration(milliseconds: 500),
() {
provider.crmUniversalSearchFunction(
context,
);
},
);
},
focusNode: focusNode,
onTapUpOutside: (event) {
focusNode.unfocus();
},
textInputAction: TextInputAction.done,
onEditingComplete: () {
provider.crmUniversalSearchFunction(context);
},
decoration: InputDecoration(
filled: true,
fillColor: AppColors.text_field_color,
suffixIconConstraints: BoxConstraints(
minWidth: 25,
maxWidth: 30,
minHeight: 25,
maxHeight: 30,
),
suffixIcon: Container(
padding: EdgeInsets.only(right: 10),
child: SvgPicture.asset(
"assets/svg/search_ic.svg",
),
),
counterText: "",
hintText: "Search",
hintStyle: TextStyle(
fontWeight: FontWeight.w400,
color: Color(0xFFB4BEC0),
fontSize: 14,
),
enabled: true,
enabledBorder: OutlineInputBorder(
borderSide: BorderSide.none,
borderRadius: BorderRadius.circular(14),
),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(
color: AppColors.cyan_blue,
),
borderRadius: BorderRadius.circular(14),
),
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(14),
),
),
),
),
),
],
),
),
if (provider.searchController.text.isNotEmpty) ...[
Container(
alignment: Alignment.topLeft,
padding: EdgeInsets.only(left: 10, top: 10, bottom: 5),
child: Text(
"Results for Result for “${provider.searchController.text}”",
style: TextStyle(
color: AppColors.app_blue,
fontSize: 16,
),
),
),
],
if (provider.accountsList.length > 0) ...[
Align(
alignment: Alignment.centerLeft,
child: Padding(
padding: EdgeInsets.symmetric(horizontal: 6),
padding: EdgeInsets.symmetric(horizontal: 10),
child: Text(
"Accounts",
style: TextStyle(
fontSize: 16,
color: AppColors.grey_semi,
color: AppColors.grey_thick,
),
),
),
......@@ -62,26 +171,84 @@ class _UniversalsearchscreenState extends State<Universalsearchscreen> {
physics: NeverScrollableScrollPhysics(),
shrinkWrap: true,
padding: EdgeInsets.symmetric(
vertical: 10,
horizontal: 10,
vertical: 5,
horizontal: 5,
),
itemCount: provider.accountsList.length,
itemBuilder: (context, index) {
String accname = provider.accountsList[index].aname ?? "";
RegExp regex =
RegExp(provider.searchController.text, caseSensitive: false);
Iterable<Match> matches =
regex.allMatches(accname);
List<TextSpan> textSpans = [];
int previousMatchEnd = 0;
for (Match match in matches) {
if (match.start > previousMatchEnd) {
// Add non-matching text before this match
textSpans.add(
TextSpan(
text: accname.substring(
previousMatchEnd, match.start),
style: TextStyle(
color: AppColors.semi_black,
fontSize: 12,
fontFamily: "JakartaMedium",
),
),
);
}
// Add the matching text with highlighting
textSpans.add(
TextSpan(
text: accname.substring(
match.start, match.end),
style: TextStyle(
color: AppColors.app_blue,
fontSize: 12, // Highlight color
fontFamily: "JakartaMedium",
),
),
);
previousMatchEnd = match.end;
}
// Add any remaining non-matching text after the last match
if (previousMatchEnd < accname.length) {
textSpans.add(
TextSpan(
text: accname.substring(previousMatchEnd),
style: TextStyle(
color: AppColors.semi_black,
fontSize: 12,
fontFamily: "JakartaMedium",
),
),
);
}
return InkResponse(
onTap: () {
Navigator.pushAndRemoveUntil(
context,
MaterialPageRoute(
builder: (context) => ProspectDetailsByMode(
pageTitleName: "Account Details",
mode: "Executive",
leadId: provider.accountsList[index].aid,
builder:
(context) => ProspectDetailsByMode(
pageTitleName: "Account Details",
mode: "Executive",
leadId:
provider.accountsList[index].aid,
),
settings: RouteSettings(
name: 'ProspectDetails',
),
settings: RouteSettings(name: 'ProspectDetails'),
),
(Route<dynamic> route) => route.settings.name == 'CrmdashboardScreen',
(Route<dynamic> route) =>
route.settings.name == 'CrmdashboardScreen',
);
},
child: Container(
decoration: BoxDecoration(
......@@ -96,19 +263,24 @@ class _UniversalsearchscreenState extends State<Universalsearchscreen> {
top: 5,
),
padding: EdgeInsets.only(
bottom: MediaQuery.of(context).viewInsets.bottom,
bottom:
MediaQuery.of(context).viewInsets.bottom,
),
child: ListTile(
title: Text(
provider.accountsList[index].aname!,
style: TextStyle(
leading: SvgPicture.asset(
"assets/svg/crm/crm_search_list_ic.svg",
),
title:RichText(text: TextSpan(
children: textSpans,
style: TextStyle(
color: AppColors.semi_black,
fontSize: 12, // Highlight color
fontFamily: "JakartaMedium",
fontSize: 14,
),
),
trailing: SvgPicture.asset(
"assets/svg/arrow_right_new.svg",
),
)),
// trailing: SvgPicture.asset(
// "assets/svg/arrow_right_new.svg",
// ),
),
),
);
......@@ -120,12 +292,12 @@ class _UniversalsearchscreenState extends State<Universalsearchscreen> {
Align(
alignment: Alignment.centerLeft,
child: Padding(
padding: EdgeInsets.symmetric(horizontal: 6),
padding: EdgeInsets.symmetric(horizontal: 10),
child: Text(
"Leads",
style: TextStyle(
fontSize: 16,
color: AppColors.grey_semi,
color: AppColors.grey_thick,
),
),
),
......@@ -134,24 +306,82 @@ class _UniversalsearchscreenState extends State<Universalsearchscreen> {
physics: NeverScrollableScrollPhysics(),
shrinkWrap: true,
padding: EdgeInsets.symmetric(
vertical: 10,
horizontal: 10,
vertical: 5,
horizontal: 5,
),
itemCount: provider.leadsList.length,
itemBuilder: (context, index) {
String accname = provider.leadsList[index].aname ?? "";
RegExp regex =
RegExp(provider.searchController.text, caseSensitive: false);
Iterable<Match> matches =
regex.allMatches(accname);
List<TextSpan> textSpans = [];
int previousMatchEnd = 0;
for (Match match in matches) {
if (match.start > previousMatchEnd) {
// Add non-matching text before this match
textSpans.add(
TextSpan(
text: accname.substring(
previousMatchEnd, match.start),
style: TextStyle(
color: AppColors.semi_black,
fontSize: 12,
fontFamily: "JakartaMedium",
),
),
);
}
// Add the matching text with highlighting
textSpans.add(
TextSpan(
text: accname.substring(
match.start, match.end),
style: TextStyle(
color: AppColors.app_blue,
fontSize: 12, // Highlight color
fontFamily: "JakartaMedium",
),
),
);
previousMatchEnd = match.end;
}
// Add any remaining non-matching text after the last match
if (previousMatchEnd < accname.length) {
textSpans.add(
TextSpan(
text: accname.substring(previousMatchEnd),
style: TextStyle(
color: AppColors.semi_black,
fontSize: 12,
fontFamily: "JakartaMedium",
),
),
);
}
return InkResponse(
onTap: () {
Navigator.pushAndRemoveUntil(
context,
MaterialPageRoute(
builder: (context) => ProspectDetailsByMode(
pageTitleName: "Lead Details",
mode: "Executive",
leadId: provider.leadsList[index].lid,
builder:
(context) => ProspectDetailsByMode(
pageTitleName: "Lead Details",
mode: "Executive",
leadId: provider.leadsList[index].lid,
),
settings: RouteSettings(
name: 'ProspectDetails',
),
settings: RouteSettings(name: 'ProspectDetails'),
),
(Route<dynamic> route) => route.settings.name == 'CrmdashboardScreen',
(Route<dynamic> route) =>
route.settings.name == 'CrmdashboardScreen',
);
},
child: Container(
......@@ -167,19 +397,24 @@ class _UniversalsearchscreenState extends State<Universalsearchscreen> {
top: 5,
),
padding: EdgeInsets.only(
bottom: MediaQuery.of(context).viewInsets.bottom,
bottom:
MediaQuery.of(context).viewInsets.bottom,
),
child: ListTile(
title: Text(
provider.leadsList[index].aname!,
style: TextStyle(
leading: SvgPicture.asset(
"assets/svg/crm/crm_search_list_ic.svg",
),
title: RichText(text: TextSpan(
children: textSpans,
style: TextStyle(
color: AppColors.semi_black,
fontSize: 12, // Highlight color
fontFamily: "JakartaMedium",
fontSize: 14,
),
),
trailing: SvgPicture.asset(
"assets/svg/arrow_right_new.svg",
),
)),
// trailing: SvgPicture.asset(
// "assets/svg/arrow_right_new.svg",
// ),
),
),
);
......@@ -190,12 +425,12 @@ class _UniversalsearchscreenState extends State<Universalsearchscreen> {
Align(
alignment: Alignment.centerLeft,
child: Padding(
padding: EdgeInsets.symmetric(horizontal: 6),
padding: EdgeInsets.symmetric(horizontal: 10),
child: Text(
"Enquiries",
style: TextStyle(
fontSize: 16,
color: AppColors.grey_semi,
color: AppColors.grey_thick,
),
),
),
......@@ -204,11 +439,72 @@ class _UniversalsearchscreenState extends State<Universalsearchscreen> {
physics: NeverScrollableScrollPhysics(),
shrinkWrap: true,
padding: EdgeInsets.symmetric(
vertical: 10,
horizontal: 10,
vertical: 5,
horizontal: 5,
),
itemCount: provider.enquiresList.length,
itemBuilder: (context, index) {
String accname = "";
if(provider.enquiresList[index].companyName!.isEmpty){
accname = provider.enquiresList[index].name ?? "";
}else{
accname = provider.enquiresList[index].companyName ?? "";
}
RegExp regex =
RegExp(provider.searchController.text, caseSensitive: false);
Iterable<Match> matches =
regex.allMatches(accname);
List<TextSpan> textSpans = [];
int previousMatchEnd = 0;
for (Match match in matches) {
if (match.start > previousMatchEnd) {
// Add non-matching text before this match
textSpans.add(
TextSpan(
text: accname.substring(
previousMatchEnd, match.start),
style: TextStyle(
color: AppColors.semi_black,
fontSize: 12,
fontFamily: "JakartaMedium",
),
),
);
}
// Add the matching text with highlighting
textSpans.add(
TextSpan(
text: accname.substring(
match.start, match.end),
style: TextStyle(
color: AppColors.app_blue,
fontSize: 12, // Highlight color
fontFamily: "JakartaMedium",
),
),
);
previousMatchEnd = match.end;
}
// Add any remaining non-matching text after the last match
if (previousMatchEnd < accname.length) {
textSpans.add(
TextSpan(
text: accname.substring(previousMatchEnd),
style: TextStyle(
color: AppColors.semi_black,
fontSize: 12,
fontFamily: "JakartaMedium",
),
),
);
}
return Container(
decoration: BoxDecoration(
color: Colors.white,
......@@ -225,18 +521,29 @@ class _UniversalsearchscreenState extends State<Universalsearchscreen> {
bottom: MediaQuery.of(context).viewInsets.bottom,
),
child: ListTile(
title: Text(
provider.enquiresList[index].companyName == ""
? provider.enquiresList[index].name!
: provider.enquiresList[index].companyName!,
style: TextStyle(
leading: SvgPicture.asset(
"assets/svg/crm/crm_search_list_ic.svg",
),
// title: Text(
// provider.enquiresList[index].companyName == ""
// ? provider.enquiresList[index].name!
// : provider.enquiresList[index].companyName!,
// style: TextStyle(
// fontFamily: "JakartaMedium",
// fontSize: 14,
// ),
// ),
title:RichText(text: TextSpan(
children: textSpans,
style: TextStyle(
color: AppColors.semi_black,
fontSize: 12, // Highlight color
fontFamily: "JakartaMedium",
fontSize: 14,
),
),
trailing: SvgPicture.asset(
"assets/svg/arrow_right_new.svg",
),
)),
// trailing: SvgPicture.asset(
// "assets/svg/arrow_right_new.svg",
// ),
),
);
},
......
......@@ -2,6 +2,7 @@ import 'dart:io';
import 'package:connectivity_plus/connectivity_plus.dart';
import 'package:flutter/material.dart';
import 'package:flutter_staggered_grid_view/flutter_staggered_grid_view.dart';
import 'package:flutter_svg/svg.dart';
import 'package:generp/Notifiers/commonProvider/accountsListProvider.dart';
import 'package:generp/Notifiers/financeProvider/DashboardProvider.dart';
......@@ -79,133 +80,580 @@ class _FinancedashboardState extends State<Financedashboard> {
return Consumer<Dashboardprovider>(
builder: (context, provider, child) {
final pages = provider.accessiblePagesList;
final approvalLevelIcons = [
"assets/svg/finance/fin_lvl1_ic.svg",
"assets/svg/finance/fin_lvl2_ic.svg",
"assets/svg/finance/fin_lvl2_self_ic.svg",
];
final approvalLevelNames = ["Level 1", "Level 2", "Level 2 (Self)"];
final approvalLevelRoles = [664, 684, 665];
final approvalModes = ["apr_lvl1", "apr_lvl2", "self_apr_lvl2"];
final paymentInitiationIcons = [
"assets/svg/finance/fin_self_ic.svg", //self
"assets/svg/finance/fin_accounts_ic.svg", //"
];
final paymentInitiationNames = ["Self", "Account List"];
final paymentInitiationSubtitles = ["Payment Requisition", ""];
final paymentInitiationRoles = [668, 293];
final paymentAdministrationIcons = [
"assets/svg/finance/fin_process_ic.svg",
"assets/svg/finance/fin_admin_ic.svg",
"assets/svg/finance/fin_receipts_ic.svg",
"assets/svg/finance/fin_ac_ledger_ic.svg",
"assets/svg/finance/fin_payments_ic.svg",
];
final paymentAdministrationNames = [
"Process", //process
"Admin", //admin
"Receipts List",
"Account Ledger",
"Payment List",
];
final paymentAdministrationSubtitles = [
"Payment Requisition",
"Payment Requisition",
"Payment Requisition",
"Ledgers, transactions, finance",
"Payment Requisition",
];
final paymentAdministrationRoles = [666, 678, 673, 675, 667];
// Extract role IDs from accessible pages
final roles = provider.accessiblePagesList.map((e) => e.id).toList();
// Filter items based on roles
final filteredApprovalLevels = <Map<String, String>>[];
for (int i = 0; i < approvalLevelRoles.length; i++) {
if (roles.contains(approvalLevelRoles[i])) {
filteredApprovalLevels.add({
'name': approvalLevelNames[i],
'icon': approvalLevelIcons[i],
});
}
}
final filteredPaymentInitiations = <Map<String, String>>[];
for (int i = 0; i < paymentInitiationRoles.length; i++) {
if (roles.contains(paymentInitiationRoles[i])) {
filteredPaymentInitiations.add({
'name': paymentInitiationNames[i],
'icon': paymentInitiationIcons[i],
'subtitle': paymentInitiationSubtitles[i],
});
}
}
final filteredPaymentAdministrations = <Map<String, String>>[];
for (int i = 0; i < paymentAdministrationRoles.length; i++) {
if (roles.contains(paymentAdministrationRoles[i])) {
filteredPaymentAdministrations.add({
'name': paymentAdministrationNames[i],
'icon': paymentAdministrationIcons[i],
'subtitle': paymentAdministrationSubtitles[i],
});
}
}
final rolesNames = provider.accessiblePagesList.map((e) => e.pageName);
final rolesModes = provider.accessiblePagesList.map((e) => e.mode);
return Scaffold(
resizeToAvoidBottomInset: true,
backgroundColor: AppColors.scaffold_bg_color,
// appBar: appbarNew(context, "Finance",0xFFCEEDFF),
appBar: appbar(context, "Finance"),
body: SizedBox(
child: SingleChildScrollView(
child: Column(
children: [
ListView.builder(
itemCount: pages.length,
shrinkWrap: true,
physics: NeverScrollableScrollPhysics(),
itemBuilder: (context, index) {
Widget? SvgIcon;
switch (pages[index].mode) {
case "apr_lvl1":
SvgIcon = SvgPicture.asset("assets/svg/fin_lv1.svg");
break;
case "apr_lvl2":
SvgIcon = SvgPicture.asset("assets/svg/fin_lv2.svg");
break;
// final icons = ["comm_ic_1", "comm_ic_2"];
case "self_apr_lvl2":
SvgIcon = SvgPicture.asset("assets/svg/fin_lv2.svg");
break;
default:
SvgIcon = SvgPicture.asset("assets/svg/fin_ic.svg");
break;
}
return InkResponse(
onTap: () async {
var navigate;
if (pages[index].pageName == "Payments List") {
navigate = Paymentlistpaymentrequisition(
pageTitleName:
provider.accessiblePagesList[index].pageName!,
);
} else if (provider
.accessiblePagesList[index]
.pageName ==
"Payment Receipts List") {
navigate = Paymentreceiptlist(
pageTitleName:
provider.accessiblePagesList[index].pageName!,
);
} else if (provider
.accessiblePagesList[index]
.pageName ==
"Account List") {
navigate = Accountslist();
// Container(
// height: 200,
// decoration: BoxDecoration(
// image: DecorationImage(image: AssetImage(
// "assets/svg/finance/main_dashboard.png",
// ), fit: BoxFit.contain,),
// gradient: LinearGradient(colors: [
// Color(0xFFCEEDFF),
// AppColors.scaffold_bg_color
// ],begin: Alignment.topCenter,end: Alignment.bottomCenter)
// ),
//
// ),
Container(
padding: EdgeInsets.symmetric(horizontal: 10),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
// if (filteredApprovalLevels.isNotEmpty) ...[
// Padding(
// padding: const EdgeInsets.only(top: 10, bottom: 5),
// child: Text(
// "Approval Levels",
// style: TextStyle(
// color: AppColors.grey_thick,
// fontSize: 14,
// fontFamily: "JakartaMedium",
// ),
// ),
// ),
// Container(
// padding: EdgeInsets.symmetric(
// vertical: 10,
// horizontal: 15,
// ),
// decoration: BoxDecoration(
// color: Colors.white,
// borderRadius: BorderRadius.circular(14),
// ),
// child: Row(
// mainAxisAlignment: MainAxisAlignment.center,
// children: List.generate(filteredApprovalLevels.length, (
// co,
// ) {
// return Expanded(
// child: InkResponse(
// onTap: () async {
// var navigate;
// navigate = Allpaymentrequesitionlistsbymodes(
// mode: approvalModes[co],
// pageTitleName:
// "Payment Requisition List ${approvalModes[co] == "apr_lvl1"
// ? "(Level 1)"
// : approvalModes[co] == "apr_lvl2"
// ? "(Level 2)"
// : "(Self Level 2)"}",
// );
//
// await Navigator.push(
// context,
// MaterialPageRoute(
// builder: (context) => navigate,
// ),
// );
// },
// child: SizedBox(
// child: Column(
// crossAxisAlignment:
// CrossAxisAlignment.center,
// mainAxisAlignment:
// MainAxisAlignment.center,
// children: [
// SvgPicture.asset(
// filteredApprovalLevels[co]['icon'] ??
// "",
// ),
// SizedBox(height: 10),
// Text(
// filteredApprovalLevels[co]['name'] ??
// "-",
// maxLines: 2,
// textAlign: TextAlign.center,
// style: TextStyle(
// fontSize: 12,
// fontFamily: "JakartaMedium",
// ),
// ),
// ],
// ),
// ),
// ),
// );
// }),
// ),
// ),
// ],
//
// if (filteredPaymentInitiations.isNotEmpty) ...[
// Padding(
// padding: const EdgeInsets.only(top: 10, bottom: 5),
// child: Text(
// "Payment Initiation",
// style: TextStyle(
// color: AppColors.grey_thick,
// fontSize: 14,
// fontFamily: "JakartaMedium",
// ),
// ),
// ),
// GridView.builder(
// shrinkWrap: true,
// padding: EdgeInsets.only(bottom: 0),
//
// itemCount: filteredPaymentInitiations.length,
// physics: NeverScrollableScrollPhysics(),
// gridDelegate:
// SliverGridDelegateWithMaxCrossAxisExtent(
// childAspectRatio: 1,
// mainAxisExtent: 100,
// maxCrossAxisExtent:
// MediaQuery.of(context).size.width * 0.5,
// ),
// itemBuilder: (context, ini) {
// return InkResponse(
// onTap: () async {
// var navigate;
// if (ini == 0) {
// navigate = await Navigator.push(
// context,
// MaterialPageRoute(
// builder:
// (
// context,
// ) => Allpaymentrequesitionlistsbymodes(
// mode: "self",
// pageTitleName:
// "Payment Requisition List (Self)",
// ),
// ),
// );
// } else {
// navigate = await Navigator.push(
// context,
// MaterialPageRoute(
// builder: (context) => Accountslist(),
// ),
// );
// }
// },
// child: Container(
// padding: EdgeInsets.symmetric(
// vertical: 5,
// horizontal: 15,
// ),
// margin: EdgeInsets.symmetric(
// vertical: 7,
// horizontal: 5,
// ),
// decoration: BoxDecoration(
// color: Colors.white,
// borderRadius: BorderRadius.circular(14),
// ),
// child: Row(
// mainAxisAlignment: MainAxisAlignment.center,
// crossAxisAlignment:
// CrossAxisAlignment.center,
// children: [
// Expanded(
// flex: 2,
// child: SizedBox(
// child: Column(
// crossAxisAlignment:
// CrossAxisAlignment.start,
// mainAxisAlignment:
// MainAxisAlignment.center,
// children: [
// Text(
// filteredPaymentInitiations[ini]['name'] ??
// "-",
// style: TextStyle(
// fontSize: 14,
// color: AppColors.app_blue,
// fontFamily: "JakartaMedium",
// ),
// ),
// Text(
// filteredPaymentInitiations[ini]['subtitle'] ??
// "-",
// style: TextStyle(
// fontSize: 12,
// color: AppColors.grey_semi,
// fontFamily: "JakartaMedium",
// ),
// ),
// ],
// ),
// ),
// ),
// SizedBox(width: 10),
// Expanded(
// flex: 1,
// child: SvgPicture.asset(
// filteredPaymentInitiations[ini]['icon'] ??
// "",
// ),
// ),
// ],
// ),
// ),
// );
// },
// ),
// ],
//
// if (filteredPaymentAdministrations.isNotEmpty) ...[
// Padding(
// padding: const EdgeInsets.only(top: 10, bottom: 5),
// child: Text(
// "Payment Administration",
// style: TextStyle(
// color: AppColors.grey_thick,
// fontSize: 14,
// fontFamily: "JakartaMedium",
// ),
// ),
// ),
// GridView.builder(
// itemCount: filteredPaymentAdministrations.length,
// physics: NeverScrollableScrollPhysics(),
// shrinkWrap: true,
// gridDelegate:
// SliverGridDelegateWithFixedCrossAxisCount(
// crossAxisCount: 2,
// childAspectRatio: 2 / 1.1,
// ),
// itemBuilder: (context, ad) {
// return InkResponse(
// onTap: () async {
// var navigate;
// if (ad == 0) {
// navigate = await Navigator.push(
// context,
// MaterialPageRoute(
// builder:
// (
// context,
// ) => Allpaymentrequesitionlistsbymodes(
// mode: "process",
// pageTitleName:
// "Payment Requisition List (Self)",
// ),
// ),
// );
// } else if (ad == 1) {
// navigate = await Navigator.push(
// context,
// MaterialPageRoute(
// builder:
// (
// context,
// ) => Allpaymentrequesitionlistsbymodes(
// mode: "admin",
// pageTitleName:
// "Payment Requisition List (Admin)",
// ),
// ),
// );
// } else if (ad == 2) {
// navigate = await Navigator.push(
// context,
// MaterialPageRoute(
// builder:
// (context) => Paymentreceiptlist(
// pageTitleName:
// "Payment Receipt List",
// ),
// ),
// );
// } else if (ad == 3) {
// navigate = await Navigator.push(
// context,
// MaterialPageRoute(
// builder: (context) => Accountledger(),
// ),
// );
// } else {
// navigate = await Navigator.push(
// context,
// MaterialPageRoute(
// builder:
// (context) =>
// Paymentlistpaymentrequisition(
// pageTitleName:
// "Payments List",
// ),
// ),
// );
// }
// },
// child: Container(
// padding: EdgeInsets.symmetric(
// vertical: 5,
// horizontal: 15,
// ),
// margin: EdgeInsets.symmetric(
// vertical: 7,
// horizontal: 5,
// ),
// decoration: BoxDecoration(
// color: Colors.white,
// borderRadius: BorderRadius.circular(14),
// ),
// child: Row(
// mainAxisAlignment:
// MainAxisAlignment.center,
// crossAxisAlignment:
// CrossAxisAlignment.center,
// children: [
// Expanded(
// flex: 2,
// child: SizedBox(
// child: Column(
// crossAxisAlignment:
// CrossAxisAlignment.start,
// mainAxisAlignment:
// MainAxisAlignment.center,
// children: [
// Text(
// filteredPaymentAdministrations[ad]['name'] ??
// "-",
// style: TextStyle(
// fontSize: 14,
// color: AppColors.app_blue,
// fontFamily: "JakartaMedium",
// ),
// ),
// Text(
// filteredPaymentAdministrations[ad]['subtitle'] ??
// "-",
// maxLines: 2,
// style: TextStyle(
// fontSize: 12,
// color: AppColors.grey_semi,
// fontFamily: "JakartaMedium",
// ),
// ),
// ],
// ),
// ),
// ),
// SizedBox(width: 10),
// Expanded(
// flex: 1,
// child: SvgPicture.asset(
// filteredPaymentAdministrations[ad]['icon'] ??
// "",
// ),
// ),
// ],
// ),
// ),
// );
// },
// ),
// ],
// SizedBox(height: 100,),
ListView.builder(
itemCount: pages.length,
shrinkWrap: true,
physics: NeverScrollableScrollPhysics(),
itemBuilder: (context, index) {
Widget? SvgIcon;
switch (pages[index].mode) {
case "apr_lvl1":
SvgIcon = SvgPicture.asset("assets/svg/fin_lv1.svg");
break;
case "apr_lvl2":
SvgIcon = SvgPicture.asset("assets/svg/fin_lv2.svg");
break;
// final icons = ["comm_ic_1", "comm_ic_2"];
case "self_apr_lvl2":
SvgIcon = SvgPicture.asset("assets/svg/fin_lv2.svg");
break;
default:
SvgIcon = SvgPicture.asset("assets/svg/fin_ic.svg");
break;
}
return InkResponse(
onTap: () async {
var navigate;
if (pages[index].pageName == "Payments List") {
navigate = Paymentlistpaymentrequisition(
pageTitleName:
provider.accessiblePagesList[index].pageName!,
);
} else if (provider
.accessiblePagesList[index]
.pageName ==
"Payment Receipts List") {
navigate = Paymentreceiptlist(
pageTitleName:
provider.accessiblePagesList[index].pageName!,
);
} else if (provider
.accessiblePagesList[index]
.pageName ==
"Account List") {
navigate = Accountslist();
// break;
} else if (provider
.accessiblePagesList[index]
.pageName ==
"Account Ledger") {
navigate = Accountledger();
} else {
navigate = Allpaymentrequesitionlistsbymodes(
mode: pages[index].mode!,
pageTitleName:
provider.accessiblePagesList[index].pageName!,
);
}
await Navigator.push(
context,
MaterialPageRoute(builder: (context) => navigate),
);
},
child: Container(
margin: EdgeInsets.symmetric(
horizontal: 5,
vertical: 5,
),
padding: EdgeInsets.symmetric(
horizontal: 10,
vertical: 15,
),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(14),
),
child: Row(
children: [
if (provider
.accessiblePagesList[index]
.pageName ==
"Account List") ...[
Expanded(
flex: 1,
child: SvgPicture.asset(
"assets/svg/comm_ic_1.svg",
width: 25,
),
// break;
} else if (provider
.accessiblePagesList[index]
.pageName ==
"Account Ledger") {
navigate = Accountledger();
} else {
navigate = Allpaymentrequesitionlistsbymodes(
mode: pages[index].mode!,
pageTitleName:
provider.accessiblePagesList[index].pageName!,
);
}
await Navigator.push(
context,
MaterialPageRoute(builder: (context) => navigate),
);
},
child: Container(
margin: EdgeInsets.symmetric(
horizontal: 5,
vertical: 5,
),
] else if (provider
.accessiblePagesList[index]
.pageName ==
"Account Ledger") ...[
Expanded(
flex: 1,
child: SvgPicture.asset(
"assets/svg/comm_ic_2.svg",
width: 25,
),
padding: EdgeInsets.symmetric(
horizontal: 10,
vertical: 15,
),
] else ...[
Expanded(flex: 1, child: SvgIcon),
],
Expanded(
flex: 5,
child: Text("${pages[index].pageName}"),
),
Expanded(
flex: 1,
child: SvgPicture.asset(
"assets/svg/arrow_right_new.svg",
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(14),
),
child: Row(
children: [
if (provider
.accessiblePagesList[index]
.pageName ==
"Account List") ...[
Expanded(
flex: 1,
child: SvgPicture.asset(
"assets/svg/comm_ic_1.svg",
width: 25,
),
),
] else if (provider
.accessiblePagesList[index]
.pageName ==
"Account Ledger") ...[
Expanded(
flex: 1,
child: SvgPicture.asset(
"assets/svg/comm_ic_2.svg",
width: 25,
),
),
] else ...[
Expanded(flex: 1, child: SvgIcon),
],
Expanded(
flex: 5,
child: Text("${pages[index].pageName}"),
),
Expanded(
flex: 1,
child: SvgPicture.asset(
"assets/svg/arrow_right_new.svg",
),
),
],
),
),
],
),
);
},
),
);
},
],
),
),
SizedBox(height: 150),
],
),
),
......
......@@ -11,20 +11,23 @@ import 'package:qr_code_scanner/qr_code_scanner.dart';
import '../../Notifiers/HomeScreenNotifier.dart';
import '../../Utils/app_colors.dart';
import '../../Utils/commonWidgets.dart';
class Scanentergeneratoridscreen extends StatefulWidget {
final from;
const Scanentergeneratoridscreen({super.key,required this.from});
const Scanentergeneratoridscreen({super.key, required this.from});
@override
State<Scanentergeneratoridscreen> createState() => _ScanentergeneratoridscreenState();
State<Scanentergeneratoridscreen> createState() =>
_ScanentergeneratoridscreenState();
}
class _ScanentergeneratoridscreenState extends State<Scanentergeneratoridscreen> {
class _ScanentergeneratoridscreenState
extends State<Scanentergeneratoridscreen> {
FocusNode genIDFocusNode = FocusNode();
TextEditingController genIDcontroller = TextEditingController();
Map _source = {ConnectivityResult.mobile: true};
final MyConnectivity _connectivity = MyConnectivity.instance;
......@@ -44,11 +47,8 @@ class _ScanentergeneratoridscreenState extends State<Scanentergeneratoridscreen>
provider.initialFunction(widget.from);
provider.checkPermission1();
provider.requestCameraPermission();
if(widget.from=="Tag Location"){
provider.checkLocationPermission1();
provider.getLocationPermission(context);
}
provider.checkLocationPermission1();
provider.getLocationPermission(context);
});
}
......@@ -59,11 +59,8 @@ class _ScanentergeneratoridscreenState extends State<Scanentergeneratoridscreen>
genIDcontroller.clear();
genIDcontroller.dispose();
_connectivity.disposeStream();
}
@override
Widget build(BuildContext context) {
switch (_source.keys.toList()[0]) {
......@@ -77,84 +74,97 @@ class _ScanentergeneratoridscreenState extends State<Scanentergeneratoridscreen>
default:
connection = 'Offline';
}
return connection=="Online"?Consumer<Generatordetailsprovider>(
builder: (context, provider, child) {
return WillPopScope(
onWillPop: () => onBackPressed(context),
child: SafeArea(
top: false,
bottom: Platform.isIOS?false:true,
child: Scaffold(
resizeToAvoidBottomInset: true,
backgroundColor: AppColors.scaffold_bg_color,
appBar: appbar(context, "${widget.from}"),
body: Container(
decoration: BoxDecoration(color: Colors.black),
child: Column(
children: [
Spacer(),
SizedBox(
height: 250,
child: QRView(
key: provider.scannerKey,
onQRViewCreated: (p0) {
provider.onQRViewCreated(p0, provider.title, context);
},
formatsAllowed: [BarcodeFormat.qrcode],
cameraFacing: CameraFacing.back,
overlay: QrScannerOverlayShape(
return connection == "Online"
? Consumer<Generatordetailsprovider>(
builder: (context, provider, child) {
return WillPopScope(
onWillPop: () => onBackPressed(context),
child: SafeArea(
top: false,
bottom: Platform.isIOS ? false : true,
child: Scaffold(
resizeToAvoidBottomInset: true,
backgroundColor: AppColors.scaffold_bg_color,
appBar: appbar(context, "${widget.from}"),
body: Container(
decoration: BoxDecoration(color: Colors.black),
child: Column(
children: [
Spacer(),
SizedBox(
height: 250,
borderColor: AppColors.app_blue,
borderRadius: 20,
borderLength: 60,
borderWidth: 10,
cutOutSize: 250.0,
child: QRView(
key: provider.scannerKey,
onQRViewCreated: (p0) {
provider.onQRViewCreated(
p0,
provider.title,
context,
);
},
formatsAllowed: [BarcodeFormat.qrcode],
cameraFacing: CameraFacing.back,
overlay: QrScannerOverlayShape(
borderColor: AppColors.app_blue,
borderRadius: 20,
borderLength: 60,
borderWidth: 10,
cutOutSize: 250.0,
),
),
),
),
),
SizedBox(height: 25),
Text(
"Scan QR",
textAlign: TextAlign.center,
style: TextStyle(fontSize: 18,fontFamily: "JakartaMedium", color: Colors.white),
),
Text(
provider.subTitle,
textAlign: TextAlign.center,
style: TextStyle(fontSize: 14, color: Colors.white),
),
Spacer(),
Text(
"or",
textAlign: TextAlign.center,
style: TextStyle(fontSize: 18,
fontFamily: "JakartaMedium",color: Colors.white),
),
InkResponse(
onTap: () async {
provider.qrViewController!.pauseCamera();
provider.submitLoading = false;
_showgenIdBottomSheet(context);
},
child: Text(
"Tap to Enter Gen ID",
textAlign: TextAlign.center,
style: TextStyle(fontSize: 18,
SizedBox(height: 25),
Text(
"Scan QR",
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 18,
fontFamily: "JakartaMedium",
color: Colors.white,
),
),
Text(
provider.subTitle,
textAlign: TextAlign.center,
style: TextStyle(fontSize: 14, color: Colors.white),
),
Spacer(),
Text(
"or",
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 18,
fontFamily: "JakartaMedium",
color: AppColors.app_blue),
),
color: Colors.white,
),
),
InkResponse(
onTap: () async {
provider.qrViewController!.pauseCamera();
provider.submitLoading = false;
_showgenIdBottomSheet(context);
},
child: Text(
"Tap to Enter Gen ID",
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 18,
fontFamily: "JakartaMedium",
color: AppColors.app_blue,
),
),
),
SizedBox(height: 50),
],
),
SizedBox(height: 50),
],
),
),
),
),
),
);
},
):NoNetwork(context);
);
},
)
: NoNetwork(context);
}
Future<void> _showgenIdBottomSheet(BuildContext context) {
......@@ -173,9 +183,9 @@ class _ScanentergeneratoridscreenState extends State<Scanentergeneratoridscreen>
child: Padding(
padding: EdgeInsets.only(
bottom:
MediaQuery.of(
context,
).viewInsets.bottom, // This handles keyboard
MediaQuery.of(
context,
).viewInsets.bottom, // This handles keyboard
),
child: Container(
margin: EdgeInsets.only(
......@@ -185,14 +195,20 @@ class _ScanentergeneratoridscreenState extends State<Scanentergeneratoridscreen>
top: 30,
),
child: Consumer2<Generatordetailsprovider, HomescreenNotifier>(
child: Consumer2<
Generatordetailsprovider,
HomescreenNotifier
>(
builder: (context, provider, homeProvider, child) {
return SingleChildScrollView(
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Container(
padding: EdgeInsets.symmetric(horizontal: 10,vertical: 5),
padding: EdgeInsets.symmetric(
horizontal: 10,
vertical: 5,
),
alignment: Alignment.topLeft,
child: Text(
"Gen ID",
......@@ -210,12 +226,12 @@ class _ScanentergeneratoridscreenState extends State<Scanentergeneratoridscreen>
color: AppColors.text_field_color,
borderRadius: BorderRadius.circular(14),
border:
genIDFocusNode.hasFocus
? Border.all(
color: AppColors.app_blue,
width: 0.5,
)
: null,
genIDFocusNode.hasFocus
? Border.all(
color: AppColors.app_blue,
width: 0.5,
)
: null,
),
// alignment: Alignment.center,
margin: EdgeInsets.only(left: 5.0, right: 5.0),
......@@ -230,7 +246,8 @@ class _ScanentergeneratoridscreenState extends State<Scanentergeneratoridscreen>
controller: genIDcontroller,
keyboardType: TextInputType.text,
textCapitalization: TextCapitalization.characters,
textCapitalization:
TextCapitalization.characters,
focusNode: genIDFocusNode,
style: TextStyle(fontSize: 14),
onChanged: (value) {},
......@@ -252,52 +269,57 @@ class _ScanentergeneratoridscreenState extends State<Scanentergeneratoridscreen>
),
),
),
SizedBox(height: 15,),
SizedBox(height: 15),
InkWell(
onTap:provider.submitLoading?null: () async {
onTap:
provider.submitLoading
? null
: () async {
switch (widget.from) {
case "Generator Details":
provider.submitLoading = true;
provider.LoadgeneratorDetailsApifunction(
homeProvider,
context,
widget.from,
genIDcontroller.text,
"1",
);
genIDcontroller.clear();
break;
// case "Register Complaint":
// provider.LoadgeneratorDetailsApifunction(
// homeProvider,
// context,
// widget.from,
// genIDcontroller.text,
// "2"
// );
// break;
// case "Tag Location":
// provider.TagLocationAPIFunction(homeProvider, context, genIDcontroller.text);
// break;
case "Tag Generator":
provider.submitLoading = false;
provider.TagGeneratorCheckAPIFunction(
homeProvider,
context,
genIDcontroller.text,
);
// final data = await ApiCalling.TagGeneratorCheckAPI(homeProvider.empId, homeProvider.session, genIDcontroller.text);
// if(data!=null){
// if(data.error==0){
// provider.showTagGeneratorBottomSheet(context, genIDcontroller.text);
// }else{
// toast(context, data.message);
// }
// }
switch(widget.from){
case "Generator Details":
provider.submitLoading = true;
provider.LoadgeneratorDetailsApifunction(
homeProvider,
context,
widget.from,
genIDcontroller.text,
"1",
);
genIDcontroller.clear();
break;
// case "Register Complaint":
// provider.LoadgeneratorDetailsApifunction(
// homeProvider,
// context,
// widget.from,
// genIDcontroller.text,
// "2"
// );
// break;
// case "Tag Location":
// provider.TagLocationAPIFunction(homeProvider, context, genIDcontroller.text);
// break;
case "Tag Generator":
provider.submitLoading = false;
final data = await ApiCalling.LoadGeneratorDetailsAPI(homeProvider.empId, homeProvider.session, genIDcontroller.text);
if(data!=null){
if(data.error==0){
provider.showTagGeneratorBottomSheet(context, genIDcontroller.text);
}else{
toast(context, "Enter Correct ID!!");
}
}
break;
default:
break;
}
},
break;
default:
break;
}
},
child: Container(
alignment: Alignment.center,
height: 45,
......@@ -312,17 +334,23 @@ class _ScanentergeneratoridscreenState extends State<Scanentergeneratoridscreen>
borderRadius: BorderRadius.circular(15.0),
),
child: Center(
child:provider.submitLoading?CircularProgressIndicator.adaptive(
valueColor: AlwaysStoppedAnimation(AppColors.white),
padding: EdgeInsets.all(10),
): Text(
"Search",
textAlign: TextAlign.center,
style: TextStyle(color: Colors.white,
fontFamily: "JakartaMedium",
fontSize: 16
),
),
child:
provider.submitLoading
? CircularProgressIndicator.adaptive(
valueColor: AlwaysStoppedAnimation(
AppColors.white,
),
padding: EdgeInsets.all(10),
)
: Text(
"Search",
textAlign: TextAlign.center,
style: TextStyle(
color: Colors.white,
fontFamily: "JakartaMedium",
fontSize: 16,
),
),
),
),
),
......@@ -343,8 +371,6 @@ class _ScanentergeneratoridscreenState extends State<Scanentergeneratoridscreen>
listen: false,
);
provider.qrViewController!.resumeCamera();
},);
});
}
}
......@@ -22,7 +22,6 @@ class _ServiceengineerdashboardState extends State<Serviceengineerdashboard> {
Map _source = {ConnectivityResult.mobile: true};
final MyConnectivity _connectivity = MyConnectivity.instance;
@override
void initState() {
super.initState();
......@@ -38,6 +37,7 @@ class _ServiceengineerdashboardState extends State<Serviceengineerdashboard> {
serviceProvider.LoadTechnicianDashboard(context);
});
}
@override
void dispose() {
// TODO: implement dispose
......@@ -58,12 +58,18 @@ class _ServiceengineerdashboardState extends State<Serviceengineerdashboard> {
default:
connection = 'Offline';
}
return (connection=="Online")? Platform.isAndroid
? WillPopScope(
onWillPop: () => onBackPressed(context),
child: SafeArea(top: false, bottom: true, child: _scaffold(context)),
)
: _scaffold(context):NoNetwork(context);
return (connection == "Online")
? Platform.isAndroid
? WillPopScope(
onWillPop: () => onBackPressed(context),
child: SafeArea(
top: false,
bottom: true,
child: _scaffold(context),
),
)
: _scaffold(context)
: NoNetwork(context);
}
Widget _scaffold(BuildContext context) {
......@@ -73,8 +79,8 @@ class _ServiceengineerdashboardState extends State<Serviceengineerdashboard> {
resizeToAvoidBottomInset: true,
backgroundColor: AppColors.scaffold_bg_color,
appBar: AppBar(
elevation: 2,
automaticallyImplyLeading: false,
elevation: 2.0,
title: SizedBox(
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
......@@ -83,10 +89,11 @@ class _ServiceengineerdashboardState extends State<Serviceengineerdashboard> {
InkResponse(
onTap: () => Navigator.pop(context, true),
child: SvgPicture.asset(
"assets/svg/app_bar_back.svg",
"assets/svg/appbar_back_button.svg",
height: 25,
),
),
SizedBox(width: 10),
InkResponse(
onTap: () => Navigator.pop(context, true),
child: Text(
......@@ -104,7 +111,7 @@ class _ServiceengineerdashboardState extends State<Serviceengineerdashboard> {
height: 25,
width: 45,
decoration: BoxDecoration(
color: Color(0xFFFFF6E2),
color: Color(0xFFEDF8FF),
borderRadius: BorderRadius.circular(20),
),
child: Row(
......@@ -131,234 +138,301 @@ class _ServiceengineerdashboardState extends State<Serviceengineerdashboard> {
),
),
),
body: Container(
child: SingleChildScrollView(
child: Column(
children: [
Container(
margin: EdgeInsets.only(top: 0, bottom: 15),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.vertical(
bottom: Radius.circular(16),
),
),
child: Column(
children: [
InkResponse(
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => Pendingcomplaints(),
body: SingleChildScrollView(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
decoration: BoxDecoration(
color: Colors.white,
// borderRadius: BorderRadius.vertical(
// bottom: Radius.circular(20),
// ),
borderRadius: BorderRadius.circular(20)
),
child: Column(
// crossAxisAlignment: CrossAxisAlignment.start,
children: [
// Container(
// height: 200,
// decoration: BoxDecoration(
// image: DecorationImage(
// image: AssetImage(
// "assets/svg/service/service_dashboard.png",
// ),
// fit: BoxFit.contain,
// ),
// gradient: LinearGradient(
// colors: [Color(0xFFFFFFFF), AppColors.white],
// begin: Alignment.topCenter,
// end: Alignment.bottomCenter,
// ),
// ),
// ),
GridView.builder(
padding: EdgeInsets.symmetric(
vertical: 10,
horizontal: 10,
),
itemCount: 4,
shrinkWrap: true,
physics: NeverScrollableScrollPhysics(),
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 2,
crossAxisSpacing: 10,
mainAxisSpacing: 10,
childAspectRatio: 22 / 11,
),
itemBuilder: (context, index) {
final numbers = [
provider.monthlyPaymentCollectionAmount,
provider.paymentCollectionWalletBalanceAmount,
provider.thisMonthsVisits,
provider.todayVisits,
];
final names = [
"Month \nCollection",
"P.C. \nWallet",
"Month \nVisits",
"Today \nVisits",
];
final List<int> colorCodes = [
0xFFE7FFE5,
0xFFFFFCD5,
0xFFF3EDFF,
0xFFFFF6F0,
];
final List<int> textColorCodes = [
0xFF0D9C00,
0xFF605C00,
0xFF493272,
0xFF91481B,
];
final assetNames = [
"assets/svg/service/month_coll_ic.svg",
"assets/svg/service/pc_wallet_ic.svg",
"assets/svg/service/month_visit_ic.svg",
"assets/svg/service/today_visit_ic.svg",
];
return InkResponse(
onTap: () {
var route;
switch (index) {
case 0:
route = Monthlycollection();
break;
case 1:
route = Pcwallet();
break;
case 2:
route = Todaymontlyvisists(
visitType: "Month",
);
break;
case 3:
route = Todaymontlyvisists(
visitType: "Today",
);
break;
}
Navigator.push(
context,
MaterialPageRoute(builder: (context) => route),
);
},
child: Container(
padding: EdgeInsets.only(
left: 10,
top: 10,
bottom: 10,
right: 10,
),
);
},
child: Container(
padding: EdgeInsets.symmetric(
horizontal: 10,
vertical: 15,
),
margin: EdgeInsets.symmetric(
horizontal: 10,
vertical: 15,
),
decoration: BoxDecoration(
color: Color(0xFFFFEFEF),
borderRadius: BorderRadius.circular(16),
),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Expanded(
child: SizedBox(
child: Column(
crossAxisAlignment:
CrossAxisAlignment.center,
children: [
decoration: BoxDecoration(
color: Color(colorCodes[index]),
borderRadius: BorderRadius.circular(20),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Row(
children: [
if ([0, 1].contains(index)) ...[
Text(
"${provider.pendingComplaints}",
"",
style: TextStyle(
fontSize: 30,
color: Color(0xFFED3424),
fontSize: 14,
color: Color(textColorCodes[index]),
),
),
Text("Pending Complaints"),
],
),
Padding(
padding: EdgeInsets.only(top: 5),
child: Text(
"${numbers[index].toString()}",
style: TextStyle(
fontSize: 20,
color: Color(textColorCodes[index]),
),
),
),
],
),
),
],
Row(
children: [
Expanded(
flex: 4,
child: Text(
names[index],
style: TextStyle(
fontSize: 14,
color: AppColors.semi_black,
),
),
),
Expanded(
flex: 1,
child: SvgPicture.asset(
assetNames[index],
),
),
],
),
],
),
),
),
),
],
),
),
Container(
padding: EdgeInsets.only(left: 15),
alignment: Alignment.topLeft,
child: Text(
"Collections & Visits",
style: TextStyle(
color: Color(0xFF818181),
fontFamily: "JakartaMedium",
fontSize: 14,
);
},
),
),
],
),
Container(
margin: EdgeInsets.symmetric(horizontal: 10, vertical: 15),
),
Padding(
padding: EdgeInsets.only(top: 10, bottom: 5, left: 10),
child: Text(
"Complaint Status",
style: TextStyle(color: AppColors.grey_thick, fontSize: 14),
),
),
InkResponse(
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => Pendingcomplaints(),
),
);
},
child: Container(
height: 60,
margin: EdgeInsets.only(left: 10,right: 10, bottom: 10),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(16),
borderRadius: BorderRadius.circular(20),
),
child: GridView.builder(
padding: EdgeInsets.symmetric(
vertical: 15,
horizontal: 10,
),
itemCount: 4,
shrinkWrap: true,
physics: NeverScrollableScrollPhysics(),
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 2,
crossAxisSpacing: 10,
mainAxisSpacing: 10,
childAspectRatio: 22 / 10,
),
itemBuilder: (context, index) {
final numbers = [
provider.monthlyPaymentCollectionAmount,
provider.paymentCollectionWalletBalanceAmount,
provider.thisMonthsVisits,
provider.todayVisits,
];
final names = [
"Month Collection",
"P.C. Wallet",
"Month Visits",
"Today Visits",
];
final List<int> colorCodes = [
0xFFE7FFE5,
0xFFFFFCD5,
0xFFF3EDFF,
0xFFFFF6F0,
];
final List<int> textColorCodes = [
0xFF0D9C00,
0xFF605C00,
0xFF493272,
0xFF91481B,
];
return InkResponse(
onTap: () {
var route;
switch (index) {
case 0:
route = Monthlycollection();
break;
case 1:
route = Pcwallet();
break;
case 2:
route = Todaymontlyvisists(visitType: "Month");
break;
case 3:
route = Todaymontlyvisists(visitType: "Today");
break;
}
Navigator.push(
context,
MaterialPageRoute(builder: (context) => route),
);
},
child: Container(
padding: EdgeInsets.only(
left: 15,
top: 5,
bottom: 5,
),
decoration: BoxDecoration(
color: Color(colorCodes[index]),
borderRadius: BorderRadius.circular(12),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Row(
children: [
if ([0, 1].contains(index)) ...[
Text(
"₹",
style: TextStyle(
fontSize: 14,
color: Color(textColorCodes[index]),
),
),
],
Padding(
padding: EdgeInsets.only(top: 5),
child: Text(
"${numbers[index].toString()}",
style: TextStyle(
fontSize: 27,
color: Color(textColorCodes[index]),
),
),
),
],
),
Text(
names[index],
style: TextStyle(color: Color(0xFF818181)),
padding: EdgeInsets.symmetric(horizontal: 10, vertical: 15),
child: SizedBox(
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Expanded(
flex: 1,
child: Container(
height: 50,
width: 50,
decoration: BoxDecoration(
color: Color(0xFFFFE4E2),
shape: BoxShape.circle,
),
child: Center(
child: Text(
"${provider.pendingComplaints}",
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 14,
color: Color(0xFFED3424),
),
),
],
),
),
),
);
},
SizedBox(width: 10),
Expanded(
flex: 5,
child: Text(
"Pending Complaints",
style: TextStyle(
fontSize: 14,
color: AppColors.app_blue,
),
),
),
],
),
),
),
InkResponse(
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => Nearbygenerators(),
),
);
},
child: Container(
height: 60,
margin: EdgeInsets.symmetric(horizontal: 10, vertical: 0),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(20),
),
Padding(
padding: EdgeInsets.only(top: 10, bottom: 5, left: 10),
child: Text(
"Nearby Generators",
style: TextStyle(color: AppColors.grey_thick, fontSize: 14),
),
),
InkResponse(
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => Nearbygenerators(),
),
);
},
child: Container(
height: 60,
margin: EdgeInsets.symmetric(horizontal: 10, vertical: 0),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(20),
),
child: Row(
children: [
Expanded(
flex: 1,
child: Row(
children: [
Expanded(
flex: 1,
child: Container(
height: 35,
width: 35,
padding: EdgeInsets.all(8.0),
decoration: BoxDecoration(
color: Color(0xFFEDF8FF),
shape: BoxShape.circle,
),
child: SvgPicture.asset(
"assets/svg/find_generator.svg",
),
),
Expanded(
flex: 4,
child: Text("Find Nearby Generators"),
),
Expanded(
flex: 4,
child: Text(
"Find Nearby Generators",
style: TextStyle(
fontSize: 14,
color: AppColors.app_blue,
),
),
],
),
),
],
),
),
],
),
),
],
),
),
);
......
import 'dart:async';
import 'dart:io';
import 'package:connectivity_plus/connectivity_plus.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:generp/Notifiers/HomeScreenNotifier.dart';
import 'package:generp/Notifiers/LogoutNotifier.dart';
import 'package:generp/Notifiers/ProfileNotifier.dart';
import 'package:generp/Utils/commonWidgets.dart';
import 'package:generp/screens/AttendanceScreen.dart';
import 'package:generp/screens/ScannerLogin.dart';
import 'package:generp/screens/WebERPIOS.dart';
import 'package:generp/screens/WebERPScreen.dart';
import 'package:generp/screens/WebWhizzdomScreen.dart';
import 'package:generp/screens/crm/crmDashboard.dart';
import 'package:generp/screens/finance/financeDashboard.dart';
import 'package:generp/screens/genTracker/GenTrackerDashboard.dart';
import 'package:generp/screens/inventory/InventoryScreen.dart';
import 'package:generp/screens/order/orderModuleDashboard.dart';
import 'package:generp/screens/serviceEngineer/serviceEngineerDashboard.dart';
import '../../Utils/app_colors.dart';
import 'package:geolocator/geolocator.dart';
import 'package:provider/provider.dart';
import 'package:cached_network_image/cached_network_image.dart';
import 'package:location/location.dart' as loc;
import 'package:auto_size_text/auto_size_text.dart';
import '../../Utils/commonServices.dart';
class MyHomePageNew extends StatefulWidget {
const MyHomePageNew({super.key});
@override
State<MyHomePageNew> createState() => _MyHomePageNewState();
}
class _MyHomePageNewState extends State<MyHomePageNew> {
Timer? timer;
Map _source = {ConnectivityResult.mobile: true};
final MyConnectivity _connectivity = MyConnectivity.instance;
@override
void initState() {
// TODO: implement initState
_connectivity.initialise();
_connectivity.myStream.listen((source) {
setState(() => _source = source);
});
var prov = Provider.of<HomescreenNotifier>(context, listen: false);
var prof_prov = Provider.of<ProfileNotifer>(context, listen: false);
Future.microtask(() {
prov.DashboardApiFunction(context);
});
Future.delayed(Duration(milliseconds: 600), () {
prof_prov.ProfileApiFunction(prov, context);
prof_prov.VersionApiFunction();
});
super.initState();
}
Future<bool> onBackPressed() async {
return await showDialog<bool>(
context: context,
builder:
(context) => AlertDialog(
title: const Text('Are you sure?'),
content: const Text('Do you want to exit the App'),
actions: [
TextButton(
style: ButtonStyle(
backgroundColor: MaterialStateProperty.all(Colors.white),
overlayColor: MaterialStateProperty.all(Colors.white),
),
onPressed: () => Navigator.of(context).pop(false),
child: Text(
"NO",
style: TextStyle(fontWeight: FontWeight.w500),
),
),
const SizedBox(height: 16),
TextButton(
style: ButtonStyle(
backgroundColor: MaterialStateProperty.all(Colors.white),
overlayColor: MaterialStateProperty.all(Colors.white70),
),
onPressed:
() => SystemChannels.platform.invokeMethod(
'SystemNavigator.pop',
),
child: Text(
"YES",
style: TextStyle(fontWeight: FontWeight.w500),
),
),
],
elevation: 30.0,
),
barrierDismissible: false,
) ??
false;
}
Future<void> requestGpsPermission() async {
bool isLocationEnabled = false;
bool hasLocationPermission = false;
isLocationEnabled = await Geolocator.isLocationServiceEnabled();
// Check if the app has been granted location permission
LocationPermission permission = await Geolocator.checkPermission();
hasLocationPermission =
permission == LocationPermission.always ||
permission == LocationPermission.whileInUse;
final loc.Location location = loc.Location();
bool serviceEnabled;
serviceEnabled = await location.serviceEnabled();
if (!serviceEnabled) {
serviceEnabled = await location.requestService();
if (!serviceEnabled) {
return;
}
}
}
@override
void dispose() {
// TODO: implement dispose
super.dispose();
_connectivity.disposeStream();
}
@override
Widget build(BuildContext context) {
switch (_source.keys.toList()[0]) {
case ConnectivityResult.mobile:
connection = 'Online';
break;
case ConnectivityResult.wifi:
connection = 'Online';
break;
case ConnectivityResult.none:
default:
connection = 'Offline';
}
return (connection == 'Online')
? Consumer2<HomescreenNotifier, ProfileNotifer>(
builder: (context, homescreen, profile, child) {
final coreRequiredRoles = ["433", "434", "430", "430"];
final requiredRoles = ["430", "430", "431", "431"];
final coreNames = ["Service", "Gen Tracker", "CRM", "Orders"];
final names = ["Attendance", "Finance", "ERP", "Whizzdom"];
final subtitles = [
"Check-in,Check-out",
"Payments, expense tracking",
"Centralized data and reports",
"Training, Assessments",
];
final coreIcons = [
"assets/svg/home/home_service_ic.svg",
"assets/svg/home/home_gentracker_ic.svg",
"assets/svg/home/home_crm_ic.svg",
"assets/svg/home/home_order_ic.svg",
];
final icons = [
"assets/svg/home/home_attendance_ic.svg",
"assets/svg/home/home_finance_ic.svg",
"assets/svg/home/home_erp_ic.svg",
"assets/svg/home/home_whizzdom_ic.svg",
];
final coreFilteredItems = <Map<String, String>>[];
final filteredItems = <Map<String, String>>[];
for (int j = 0; j < names.length; j++) {
if (homescreen.roleStatus.contains(requiredRoles[j])) {
filteredItems.add({
'name': names[j],
'icon': icons[j],
'subtitle': subtitles[j],
});
}
}
for (int i = 0; i < coreNames.length; i++) {
if (homescreen.roleStatus.contains(coreRequiredRoles[i])) {
coreFilteredItems.add({
'name': coreNames[i],
'icon': coreIcons[i],
});
}
}
return WillPopScope(
onWillPop: onBackPressed,
child: RefreshIndicator.adaptive(
color: AppColors.app_blue,
onRefresh: () async {
await Future.delayed(const Duration(milliseconds: 600));
homescreen.DashboardApiFunction(context);
},
child: SafeArea(
top: false,
bottom: Platform.isIOS ? false : true,
child: Scaffold(
resizeToAvoidBottomInset: true,
backgroundColor: AppColors.scaffold_bg_color,
appBar: AppBar(
automaticallyImplyLeading: false,
toolbarHeight: 0,
backgroundColor: Colors.white,
),
body: SizedBox(
child: Column(
children: [
Expanded(
flex: 3,
child: Container(
padding: EdgeInsets.symmetric(vertical: 5),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.vertical(
bottom: Radius.circular(30),
),
),
child: Container(
margin: EdgeInsets.only(
bottom: 15,
left: 15,
right: 15,
top: 30,
),
padding: EdgeInsets.only(bottom: 15, right: 10),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(30),
gradient: LinearGradient(
colors: [
AppColors.profile_card,
AppColors.profile_card,
],
),
),
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Expanded(
flex: 2,
child: Padding(
padding: EdgeInsets.symmetric(
vertical: 15,
),
child: Column(
mainAxisAlignment:
MainAxisAlignment.center,
children: [
SizedBox(
width: 60,
height: 60,
child: ClipRRect(
borderRadius:
BorderRadius.circular(50),
child: CachedNetworkImage(
cacheKey:
profile.profileImage,
fit: BoxFit.cover,
imageUrl:
"${profile.profileImage}",
useOldImageOnUrlChange: false,
placeholder:
(context, url) =>
CircularProgressIndicator.adaptive(),
errorWidget:
(context, url, error) =>
Icon(Icons.error),
),
),
),
Spacer(),
Row(
mainAxisAlignment:
MainAxisAlignment.center,
children: [
Container(
width: 13,
height: 13,
decoration: BoxDecoration(
shape: BoxShape.circle,
color:
homescreen.onlineStatus ==
"Online"
? Colors.green
: Colors.yellow,
),
),
SizedBox(width: 6),
Text(
"${homescreen.onlineStatus}",
style: TextStyle(
fontSize: 16,
fontFamily: "JakartaMedium",
color: Color(0xFF2D2D2D),
),
),
],
),
],
),
),
),
Expanded(
flex: 3,
child: Container(
padding: EdgeInsets.symmetric(
vertical: 15,
),
child: Column(
crossAxisAlignment:
CrossAxisAlignment.start,
mainAxisAlignment:
MainAxisAlignment.center,
children: [
// Text(
// "${profile.employeeName}",
// maxLines: 1,
// style: TextStyle(
// color: AppColors.app_blue,
// fontFamily: "JakartaSemiBold",
// fontSize: 18,
// ),
// ),
AutoSizeText(
'${profile.employeeName}',
maxFontSize: 16,
minFontSize: 12,
style: TextStyle(
fontSize: 16,
color: AppColors.app_blue,
fontFamily: "JakartaSemiBold",
),
maxLines: 2,
),
AutoSizeText(
'(${profile.designation})',
maxFontSize: 14,
minFontSize: 10,
style: TextStyle(
fontSize: 14,
color: AppColors.semi_black,
fontFamily: "JakartaRegular",
),
maxLines: 1,
),
// Text(
// "${profile.designation}",
// maxLines: 1,
// style: TextStyle(
// color: AppColors.semi_black,
// fontFamily: "JakartaRegular",
// fontSize: 14,
// ),
// ),
Text(
"${profile.employeeeID}",
style: TextStyle(
color: AppColors.semi_black,
fontFamily: "JakartaRegular",
fontSize: 14,
),
),
Spacer(),
InkResponse(
onTap: () {
_showProfileBottomSheet(
context,
);
},
child: Padding(
padding:
const EdgeInsets.symmetric(
vertical: 3.0,
),
child: Row(
mainAxisAlignment:
MainAxisAlignment.start,
crossAxisAlignment:
CrossAxisAlignment.center,
children: [
Text(
"View Profile",
style: TextStyle(
color:
AppColors.app_blue,
fontFamily:
"JakartaRegular",
fontSize: 14,
),
),
SizedBox(width: 5),
SizedBox(
width: 13,
height: 13,
child: Center(
child: SvgPicture.asset(
"assets/svg/next_button.svg",
),
),
),
],
),
),
),
],
),
),
),
],
),
),
),
),
Expanded(
flex: 10,
child: Container(
margin: EdgeInsets.symmetric(horizontal: 10),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
if (coreFilteredItems.isNotEmpty) ...[
Padding(
padding: const EdgeInsets.only(
top: 10,
bottom: 5,
),
child: Text(
"Core Functionalities",
style: TextStyle(
color: AppColors.grey_thick,
fontSize: 14,
fontFamily: "JakartaMedium",
),
),
),
Container(
padding: EdgeInsets.symmetric(
vertical: 10,
horizontal: 15,
),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(14),
),
child: Row(
mainAxisAlignment:
MainAxisAlignment.center,
children: List.generate(4, (ic) {
return Expanded(
child: InkResponse(
onTap: () async {
var res;
switch (coreFilteredItems[ic]['name']) {
case "Gen Tracker":
res = await Navigator.push(
context,
MaterialPageRoute(
builder:
(context) =>
Gentrackerdashboard(),
settings: RouteSettings(
arguments:
'Gentrackerdashboard',
),
),
);
break;
case "Service":
res = await Navigator.push(
context,
MaterialPageRoute(
builder:
(context) =>
Serviceengineerdashboard(),
),
);
break;
case "Orders":
res = await Navigator.push(
context,
MaterialPageRoute(
builder:
(context) =>
Ordermoduledashboard(),
),
);
case "CRM":
res = await Navigator.push(
context,
MaterialPageRoute(
builder:
(context) =>
CrmdashboardScreen(),
settings: RouteSettings(
name:
'CrmdashboardScreen',
),
),
);
default:
print("111");
break;
}
if (res == true) {
homescreen.DashboardApiFunction(
context,
);
}
},
child: SizedBox(
child: Column(
crossAxisAlignment:
CrossAxisAlignment.center,
mainAxisAlignment:
MainAxisAlignment.center,
children: [
SvgPicture.asset(
coreFilteredItems[ic]['icon'] ??
"-",
),
SizedBox(height: 10),
Text(
coreFilteredItems[ic]['name'] ??
"-",
maxLines: 2,
textAlign:
TextAlign.center,
style: TextStyle(
fontSize: 12,
fontFamily:
"JakartaMedium",
),
),
],
),
),
),
);
}),
),
),
],
if (homescreen.roleStatus.contains(
"432",
)) ...[
Padding(
padding: const EdgeInsets.only(
top: 10,
bottom: 5,
),
child: Text(
"Inventory Management",
style: TextStyle(
color: AppColors.grey_thick,
fontSize: 14,
fontFamily: "JakartaMedium",
),
),
),
InkResponse(
onTap: () async {
var res = await Navigator.push(
context,
MaterialPageRoute(
builder:
(context) => InventoryScreen(),
),
);
if (res == true) {
homescreen.DashboardApiFunction(
context,
);
}
},
child: Container(
padding: EdgeInsets.symmetric(
vertical: 15,
horizontal: 15,
),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(
14,
),
),
child: Row(
mainAxisAlignment:
MainAxisAlignment.center,
children: [
Expanded(
flex: 1,
child: SvgPicture.asset(
"assets/svg/home/home_inventory_ic.svg",
),
),
SizedBox(width: 10),
Expanded(
flex: 5,
child: SizedBox(
child: Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Text(
"Inventory",
style: TextStyle(
fontSize: 14,
color:
AppColors.app_blue,
fontFamily:
"JakartaMedium",
),
),
Text(
"Stock Management, Evaluations",
style: TextStyle(
fontSize: 14,
color:
AppColors.grey_semi,
fontFamily:
"JakartaMedium",
),
),
],
),
),
),
],
),
),
),
],
if (filteredItems.isNotEmpty) ...[
Padding(
padding: const EdgeInsets.only(
top: 10,
bottom: 5,
),
child: Text(
"Workforce & Operations",
style: TextStyle(
color: AppColors.grey_thick,
fontSize: 14,
fontFamily: "JakartaMedium",
),
),
),
Expanded(
child: GridView.builder(
itemCount: filteredItems.length,
gridDelegate:
SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 2,
childAspectRatio: 2 / 1.1,
),
itemBuilder: (context, ci) {
return InkResponse(
onTap: () async {
var res;
switch (filteredItems[ci]['name']) {
case "Attendance":
res = await Navigator.push(
context,
MaterialPageRoute(
builder:
(context) =>
AttendanceScreen(),
settings: RouteSettings(
arguments:
'AttendanceScreen',
),
),
);
break;
case "ERP":
bool isGpsEnabled =
await Geolocator.isLocationServiceEnabled();
if (isGpsEnabled) {
if (Platform.isAndroid) {
res = await Navigator.push(
context,
MaterialPageRoute(
builder:
(
context,
) => WebErpScreen(
erp_url:
homescreen
.webPageUrl,
),
),
);
} else {
res = await Navigator.push(
context,
MaterialPageRoute(
builder:
(
context,
) => WebERPIOS(
url:
homescreen
.webPageUrl,
),
),
);
}
} else {
requestGpsPermission();
}
break;
case "Whizzdom":
bool isGpsEnabled =
await Geolocator.isLocationServiceEnabled();
if (isGpsEnabled) {
res = await Navigator.push(
context,
MaterialPageRoute(
builder:
(
context,
) => WebWhizzdomScreen(
whizzdom_url:
homescreen
.whizzdomPageUrl,
),
),
);
} else {
requestGpsPermission();
}
break;
case "Finance":
res = await Navigator.push(
context,
MaterialPageRoute(
builder:
(context) =>
Financedashboard(),
settings: RouteSettings(
arguments:
'Financedashboard',
),
),
);
break;
default:
print("111");
break;
}
if (res == true) {
homescreen.DashboardApiFunction(
context,
);
}
},
child: Container(
padding: EdgeInsets.symmetric(
vertical: 5,
horizontal: 15,
),
margin: EdgeInsets.symmetric(
vertical: 7,
horizontal: 5,
),
decoration: BoxDecoration(
color: Colors.white,
borderRadius:
BorderRadius.circular(14),
),
child: Row(
mainAxisAlignment:
MainAxisAlignment.center,
crossAxisAlignment:
CrossAxisAlignment.center,
children: [
Expanded(
flex: 2,
child: SizedBox(
child: Column(
crossAxisAlignment:
CrossAxisAlignment
.start,
mainAxisAlignment:
MainAxisAlignment
.center,
children: [
Text(
filteredItems[ci]['name'] ??
"-",
style: TextStyle(
fontSize: 14,
color:
AppColors
.app_blue,
fontFamily:
"JakartaMedium",
),
),
Text(
filteredItems[ci]['subtitle'] ??
"-",
style: TextStyle(
fontSize: 12,
color:
AppColors
.grey_semi,
fontFamily:
"JakartaMedium",
),
),
],
),
),
),
SizedBox(width: 10),
Expanded(
flex: 1,
child: SvgPicture.asset(
filteredItems[ci]['icon'] ??
"-",
),
),
],
),
),
);
},
),
),
],
],
),
),
),
// Expanded(
// flex: 10,
// child: Container(
// padding: EdgeInsets.only(
// left: 20,
// right: 20,
// top: 0,
// bottom: 10,
// ),
// margin: EdgeInsets.only(top: 10),
// child: GridView.builder(
// itemCount: filteredItems.length,
// gridDelegate:
// SliverGridDelegateWithFixedCrossAxisCount(
// crossAxisCount: 2,
// crossAxisSpacing: 10,
// mainAxisSpacing: 10,
// ),
// itemBuilder: (context, index) {
// final item = filteredItems[index];
// return InkResponse(
// onTap: () async {
// var res;
// switch (item['name']) {
// case "Attendance":
// res = await Navigator.push(
// context,
// MaterialPageRoute(
// builder:
// (context) =>
// AttendanceScreen(),
// settings: RouteSettings(
// arguments: 'AttendanceScreen',
// ),
// ),
// );
// break;
// case "ERP":
// bool isGpsEnabled =
// await Geolocator.isLocationServiceEnabled();
// if (isGpsEnabled) {
// if (Platform.isAndroid) {
// res = await Navigator.push(
// context,
// MaterialPageRoute(
// builder:
// (context) => WebErpScreen(
// erp_url:
// homescreen
// .webPageUrl,
// ),
// ),
// );
// } else {
// res = await Navigator.push(
// context,
// MaterialPageRoute(
// builder:
// (context) => WebERPIOS(
// url:
// homescreen
// .webPageUrl,
// ),
// ),
// );
// }
// } else {
// requestGpsPermission();
// }
//
// break;
// case "Gen Tracker":
// res = await Navigator.push(
// context,
// MaterialPageRoute(
// builder:
// (context) =>
// Gentrackerdashboard(),
// settings: RouteSettings(
// arguments:
// 'Gentrackerdashboard',
// ),
// ),
// );
// break;
// case "Service Engineer":
// res = await Navigator.push(
// context,
// MaterialPageRoute(
// builder:
// (context) =>
// Serviceengineerdashboard(),
// ),
// );
// break;
// case "Nearby":
// res = await Navigator.push(
// context,
// MaterialPageRoute(
// builder:
// (context) =>
// Nearbygenerators(),
// ),
// );
//
// break;
// case "Inventory":
// res = await Navigator.push(
// context,
// MaterialPageRoute(
// builder:
// (context) =>
// InventoryScreen(),
// ),
// );
// break;
// case "Whizzdom":
// bool isGpsEnabled =
// await Geolocator.isLocationServiceEnabled();
// if (isGpsEnabled) {
// res = await Navigator.push(
// context,
// MaterialPageRoute(
// builder:
// (
// context,
// ) => WebWhizzdomScreen(
// whizzdom_url:
// homescreen
// .whizzdomPageUrl,
// ),
// ),
// );
// } else {
// requestGpsPermission();
// }
// break;
// case "Common":
// res = await Navigator.push(
// context,
// MaterialPageRoute(
// builder:
// (context) =>
// Commondashboard(),
// ),
// );
// break;
// case "Finance":
// res = await Navigator.push(
// context,
// MaterialPageRoute(
// builder:
// (context) =>
// Financedashboard(),
// settings: RouteSettings(
// arguments: 'Financedashboard',
// ),
// ),
// );
// break;
// case "Orders":
// res = await Navigator.push(
// context,
// MaterialPageRoute(
// builder:
// (context) =>
// Ordermoduledashboard(),
// ),
// );
// case "CRM":
// res = await Navigator.push(
// context,
// MaterialPageRoute(
// builder:
// (context) =>
// CrmdashboardScreen(),
// settings: RouteSettings(
// name: 'CrmdashboardScreen',
// ),
// ),
// );
// default:
// print("111");
// break;
// }
// if (res == true) {
// homescreen.DashboardApiFunction(
// context,
// );
// }
// },
// child: Container(
// decoration: BoxDecoration(
// color: Colors.white,
// borderRadius: BorderRadius.circular(30),
// ),
// child: Column(
// crossAxisAlignment:
// CrossAxisAlignment.center,
// mainAxisAlignment:
// MainAxisAlignment.center,
// children: [
// SvgPicture.asset(
// item['icon']!,
// height: 45,
// ),
// SizedBox(height: 10),
// Text(item['name']!),
// ],
// ),
// ),
// );
// },
// ),
// ),
// ),
],
),
),
),
),
),
);
},
)
: NoNetwork(context);
}
Future<void> _showProfileBottomSheet(BuildContext context) {
return showModalBottomSheet(
useSafeArea: true,
isDismissible: true,
isScrollControlled: true,
showDragHandle: true,
enableDrag: true,
context: context,
builder: (context) {
return StatefulBuilder(
builder: (context, setState) {
return SafeArea(
child: Container(
margin: EdgeInsets.only(
bottom: 15,
left: 15,
right: 15,
top: 30,
),
padding: EdgeInsets.only(
bottom: MediaQuery.of(context).viewInsets.bottom,
),
child: Consumer3<
HomescreenNotifier,
ProfileNotifer,
LogoutNotifier
>(
builder: (context, home, profile, logout, child) {
return SingleChildScrollView(
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Padding(
padding: const EdgeInsets.symmetric(
horizontal: 5.0,
),
child: Row(
children: [
SizedBox(
height: 35,
child: Image.asset(
"assets/images/gen_horiz_logo.png",
),
),
Spacer(),
InkResponse(
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => Scannerlogin(),
),
);
},
child: SizedBox(
height: 25,
width: 25,
child: SvgPicture.asset(
"assets/svg/scanner.svg",
),
),
),
],
),
),
SizedBox(height: 15),
Container(
padding: EdgeInsets.symmetric(
horizontal: 5,
vertical: 10,
),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(30),
gradient: LinearGradient(
colors: [
AppColors.profile_card_gradient1,
AppColors.profile_card_gradient2,
],
),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Padding(
padding: EdgeInsets.all(10),
child: SizedBox(
width: 70,
height: 70,
child: ClipRRect(
borderRadius: BorderRadius.circular(50),
child: CachedNetworkImage(
cacheKey: profile.profileImage,
fit: BoxFit.cover,
imageUrl: "${profile.profileImage}",
useOldImageOnUrlChange: false,
placeholder:
(context, url) =>
CircularProgressIndicator.adaptive(),
errorWidget:
(context, url, error) =>
Icon(Icons.error),
),
),
),
),
Text(
"${profile.employeeName}",
textAlign: TextAlign.center,
style: TextStyle(
color: AppColors.app_blue,
fontFamily: "JakartaSemiBold",
fontSize: 18,
),
),
Text(
"${profile.employeeEmail}",
textAlign: TextAlign.center,
style: TextStyle(
color: AppColors.semi_black,
fontSize: 14,
),
),
Container(
padding: EdgeInsets.symmetric(horizontal: 20),
alignment: Alignment.center,
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment:
CrossAxisAlignment.center,
children: [
Expanded(
flex: 1,
child: ListView.builder(
shrinkWrap: true,
itemCount: 5,
physics:
NeverScrollableScrollPhysics(),
itemBuilder: (context, index) {
final textHeadings = [
"Company",
"Branch",
"Designation",
"Employee ID",
"Mobile Number",
];
return SizedBox(
height: 40,
child: Align(
alignment: Alignment.centerLeft,
child: Text(
"${textHeadings[index]}",
textAlign: TextAlign.left,
style: TextStyle(
fontSize: 14,
fontFamily: "JakartaMedium",
color: AppColors.app_blue,
),
),
),
);
},
),
),
Expanded(
flex: 1,
child: ListView.builder(
shrinkWrap: true,
itemCount: 5,
physics:
NeverScrollableScrollPhysics(),
itemBuilder: (context, index) {
final textHeadings = [
profile.company,
profile.branch,
profile.designation,
profile.employeeeID,
profile.mobileNUmber,
];
return SizedBox(
height: 40,
child: Align(
alignment: Alignment.centerLeft,
child: Text(
"${textHeadings[index].toString()}",
textAlign: TextAlign.left,
style: TextStyle(
fontSize: 14,
color: AppColors.semi_black,
),
),
),
);
},
),
),
],
),
),
],
),
),
SizedBox(height: 10),
InkWell(
onTap: () {
// LoginApiFunction();
var f = FocusScope.of(context);
if (!f.hasPrimaryFocus) {
f.unfocus();
}
_showLogoutBottomSheet(context);
// Navigator.push(context,MaterialPageRoute(builder: (context)=>Profile()));
},
child: Container(
alignment: Alignment.center,
height: 45,
margin: EdgeInsets.only(
left: 5.0,
right: 5.0,
top: 5.0,
bottom: 5.0,
),
decoration: BoxDecoration(
color: AppColors.app_blue, //1487C9
borderRadius: BorderRadius.circular(15.0),
),
child: Center(
child: Text(
"Logout",
textAlign: TextAlign.center,
style: TextStyle(color: Colors.white),
),
),
),
),
Text(
profile.releaseNotes,
style: TextStyle(
fontSize: 14,
color: AppColors.grey_thick,
),
),
],
),
);
},
),
),
);
},
);
},
);
}
Future<void> _showLogoutBottomSheet(BuildContext context) {
return showModalBottomSheet(
useSafeArea: true,
isDismissible: true,
isScrollControlled: true,
showDragHandle: true,
enableDrag: true,
context: context,
builder: (context) {
return StatefulBuilder(
builder: (context, setState) {
return SafeArea(
child: Container(
margin: EdgeInsets.only(
bottom: 15,
left: 15,
right: 15,
top: 30,
),
padding: EdgeInsets.only(
bottom: MediaQuery.of(context).viewInsets.bottom,
),
child: Consumer3<
HomescreenNotifier,
ProfileNotifer,
LogoutNotifier
>(
builder: (context, home, profile, logout, child) {
return SingleChildScrollView(
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text(
"Are you sure you want \nto logout ?",
textAlign: TextAlign.center,
style: TextStyle(
fontFamily: "JakartaMedium",
color: AppColors.semi_black,
fontSize: 18,
),
),
],
),
SizedBox(height: 20),
InkWell(
onTap: () {
// LoginApiFunction();
var f = FocusScope.of(context);
if (!f.hasPrimaryFocus) {
f.unfocus();
}
logout.LogoutApiFunction(home, context);
// Navigator.push(context,MaterialPageRoute(builder: (context)=>Profile()));
},
child: Container(
alignment: Alignment.center,
height: 45,
margin: EdgeInsets.only(
left: 5.0,
right: 5.0,
top: 5.0,
bottom: 5.0,
),
decoration: BoxDecoration(
color: AppColors.app_blue, //1487C9
borderRadius: BorderRadius.circular(15.0),
),
child: Center(
child: Text(
"Yes, Logout",
textAlign: TextAlign.center,
style: TextStyle(
color: Colors.white,
fontFamily: "JakartaMedium",
),
),
),
),
),
InkWell(
onTap: () {
// LoginApiFunction();
var f = FocusScope.of(context);
if (!f.hasPrimaryFocus) {
f.unfocus();
}
Navigator.pop(context);
},
child: Container(
alignment: Alignment.center,
height: 45,
margin: EdgeInsets.only(
left: 5.0,
right: 5.0,
top: 5.0,
bottom: 5.0,
),
child: Center(
child: Text(
"Cancel",
textAlign: TextAlign.center,
style: TextStyle(
color: AppColors.app_blue,
fontFamily: "JakartaMedium",
),
),
),
),
),
],
),
);
},
),
),
);
},
);
},
);
}
}
import 'dart:io';
import 'package:connectivity_plus/connectivity_plus.dart';
import 'package:dotted_line/dotted_line.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_svg/svg.dart';
import 'package:generp/screens/crm/universalSearchScreen.dart';
import 'package:provider/provider.dart';
import 'package:generp/screens/screensExports.dart';
import '../../Notifiers/crmProvider/crmDashboardProvider.dart';
import '../../Utils/app_colors.dart';
import '../../Utils/commonServices.dart';
import '../../Utils/commonWidgets.dart';
class CrmdashboardScreenUpdated extends StatefulWidget {
const CrmdashboardScreenUpdated({super.key});
@override
State<CrmdashboardScreenUpdated> createState() => _CrmdashboardScreenUpdatedState();
}
class _CrmdashboardScreenUpdatedState extends State<CrmdashboardScreenUpdated> {
FocusNode focusNode = FocusNode();
Map _source = {ConnectivityResult.mobile: true};
final MyConnectivity _connectivity = MyConnectivity.instance;
@override
void initState() {
super.initState();
_connectivity.initialise();
_connectivity.myStream.listen((event) {
setState(() => _source = event);
});
WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
var prov = Provider.of<Crmdashboardprovider>(context, listen: false);
prov.accessPagesAPIFunction(context);
prov.crmDashboardAPIFunction(context, "executive", "", "", "");
prov.crmPendingTasksAPIFunction(context);
});
}
@override
void dispose() {
// TODO: implement dispose
super.dispose();
_connectivity.disposeStream();
}
@override
Widget build(BuildContext context) {
switch (_source.keys.toList()[0]) {
case ConnectivityResult.mobile:
connection = 'Online';
break;
case ConnectivityResult.wifi:
connection = 'Online';
break;
case ConnectivityResult.none:
default:
connection = 'Offline';
}
return (connection == "Online")
? Platform.isAndroid
? WillPopScope(
onWillPop: () => onBackPressed(context),
child: SafeArea(
top: false,
bottom: true,
child: _scaffold(context),
),
)
: _scaffold(context)
: NoNetwork(context);
}
Widget _scaffold(BuildContext context) {
return Consumer<Crmdashboardprovider>(
builder: (context, provider, child) {
final gridPages =
provider.accessPages
.where((page) => ![8, 9, 23, 24, 51, 50].contains(page.id))
.toList();
return Scaffold(
resizeToAvoidBottomInset: true,
backgroundColor: AppColors.scaffold_bg_color,
appBar: AppBar(
automaticallyImplyLeading: false,
// elevation: 2.0,
title: SizedBox(
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
InkResponse(
onTap: () => Navigator.pop(context, true),
child: SvgPicture.asset(
"assets/svg/appbar_back_button.svg",
height: 25,
),
),
SizedBox(width: 10),
InkResponse(
onTap: () => Navigator.pop(context, true),
child: Text(
"CRM",
style: TextStyle(
fontSize: 16,
height: 1.1,
fontFamily: "JakartaSemiBold",
color: AppColors.semi_black,
),
),
),
],
),
),
bottom: PreferredSize(
preferredSize: Size.fromHeight(50),
child: InkResponse(
onTap: () {
print("Tap");
Navigator.push(
context,
MaterialPageRoute(
builder:
(context) => Universalsearchscreen(
text: provider.searchController.text,
),
settings: RouteSettings(name: 'SearchScreen'),
),
);
},
child: Container(
padding: const EdgeInsets.fromLTRB(5.0, 0.0, 10, 0),
margin: const EdgeInsets.fromLTRB(10.0, 0.0, 10, 10),
height: 50,
alignment: Alignment.center,
decoration: BoxDecoration(
color: AppColors.text_field_color,
borderRadius: BorderRadius.circular(14),
),
child: Row(
children: [
Expanded(
child: Container(
alignment: Alignment.centerLeft,
padding: const EdgeInsets.fromLTRB(0.0, 0.0, 10, 0),
margin: const EdgeInsets.fromLTRB(10.0, 0.0, 10, 10),
child: Text("Search",style: TextStyle(
color: AppColors.grey_thick,
fontSize:14
),),
),
),
SvgPicture.asset("assets/svg/search_ic.svg"),
],
),
),
),
),
// shape: RoundedRectangleBorder(
// borderRadius: BorderRadius.vertical(
// bottom: Radius.circular(30), // Adjust the radius as needed
// ),
// ),
),
body: SingleChildScrollView(
physics: AlwaysScrollableScrollPhysics(),
child: Column(
children: [
if (provider.allLeads.length > 0) ...[
Container(
padding: EdgeInsets.symmetric(horizontal: 10, vertical: 5),
margin: EdgeInsets.only(bottom: 10),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.vertical(
bottom: Radius.circular(16),
),
),
height: MediaQuery.of(context).size.height * 0.25,
child: GridView.builder(
padding: EdgeInsets.symmetric(horizontal: 0, vertical: 5),
itemCount: provider.allLeads.length,
shrinkWrap: true,
scrollDirection: Axis.horizontal,
physics: AlwaysScrollableScrollPhysics(),
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 2,
crossAxisSpacing: 10,
mainAxisSpacing: 10,
childAspectRatio: 55 / 100,
),
itemBuilder: (context, jndex) {
final icons = ["comm_ic_1", "comm_ic_2"];
final leadTitles = [
'Open Leads',
'Quotation Generated',
'Pending Tasks',
'Today Visits',
'Today Calls',
'Hot Leads'
'Cold Leads',
'Warm Leads',
// 'Total Leads',
// 'Order Lost',
// 'No Requirement',
// 'Open Enquiries',
];
final assetNames = [
"assets/svg/crm/open_leads_ic.svg",
"assets/svg/crm/quotes_generated_ic.svg",
"assets/svg/crm/pending_tasks_ic.svg",
"assets/svg/crm/today_visits_ic.svg",
"assets/svg/crm/today_calls_ic.svg",
"assets/svg/crm/hot_leads_ic.svg",
"assets/svg/crm/cold_leads_ic.svg",
"assets/svg/crm/warm_leads_ic.svg",
];
final colors = [
0xFFE7FFE5,
0xFFF3EDFF,
0xFFFFFCD5,
0xFFFFF6F0,
0xFFE7FFE5,
0xFFF3EDFF,
0xFFFFFCD5,
0xFFFFF6F0,
];
final textcolors = [
0xFF0D9C00,
0xFF493272,
0xFF605C00,
0xFF91481B,
0xFF0D9C00,
0xFF493272,
0xFF605C00,
0xFF91481B,
];
return InkResponse(
onTap: () async {
if (provider.allLeads[jndex].filter!.pageName !=
"") {
if (provider.allLeads[jndex].filter!.pageName!
.contains("Lead List")) {
await Navigator.push(
context,
MaterialPageRoute(
builder:
(context) => Leadlistbymode(
pageTitleName:
provider
.allLeads[jndex]
.filter!
.pageName!,
mode:
provider
.allLeads[jndex]
.filter!
.mode,
filter:
provider.allLeads[jndex].filter!,
),
),
);
}
}
},
child: Container(
padding: EdgeInsets.symmetric(horizontal: 13),
decoration: BoxDecoration(
color: Color(colors[jndex]),
borderRadius: BorderRadius.circular(20),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
provider.allLeads[jndex].count.toString(),
style: TextStyle(
fontSize: 20,
fontFamily: "JakartaMedium",
color: Color(textcolors[jndex]),
),
),
Row(
children: [
Expanded(
flex: 3,
child: Text(
leadTitles[jndex],
style: TextStyle(
fontSize: 14,
fontFamily: "JakartaRegular",
color: AppColors.semi_black,
),
),
),
Expanded(
flex: 1,
child: SvgPicture.asset(
assetNames[jndex],
),
),
],
),
],
),
),
);
},
),
),
],
// ListView.builder(
// physics: NeverScrollableScrollPhysics(),
// shrinkWrap: true,
// padding: EdgeInsets.symmetric(vertical: 10, horizontal: 10),
// itemCount: gridPages.length,
// itemBuilder: (context, index) {
// // final icons = ["comm_ic_1", "comm_ic_2"];
// Widget? SvgIcon;
//
// if (gridPages[index].pageName!.contains("Lead List")) {
// SvgIcon = SvgPicture.asset("assets/svg/fin_lv1.svg");
// } else if (gridPages[index].pageName == "Nearby Leads") {
// SvgIcon = SvgPicture.asset(
// "assets/svg/home_icons_5.svg",
// height: 18,
// width: 18,
// );
// } else {
// SvgIcon = SvgPicture.asset("assets/svg/fin_ic.svg");
// }
// return InkResponse(
// onTap: () {
// print(gridPages[index].pageName!);
// if (gridPages[index].pageName!.contains("Lead List")) {
// Navigator.push(
// context,
// MaterialPageRoute(
// builder:
// (context) => Leadlistbymode(
// mode: gridPages[index].mode,
// pageTitleName: gridPages[index].pageName,
// ),
// ),
// );
// } else if (gridPages[index].pageName!.contains(
// "Account List",
// )) {
// Navigator.push(
// context,
// MaterialPageRoute(
// builder:
// (context) => ProspectListByMode(
// mode: gridPages[index].mode,
// pageTitleName: gridPages[index].pageName,
// ),
// ),
// );
// } else if (gridPages[index].pageName ==
// "Nearby Leads") {
// Navigator.push(
// context,
// MaterialPageRoute(
// builder: (context) => NearbyOpenLeads(),
// ),
// );
// }
// // switch (gridPages[index].pageName!) {
// // case "Lead List":
// // Navigator.push(
// // context,
// // MaterialPageRoute(builder: (context) => Leadlistbymode()),
// // );
// // break;
// // case "Prospect List":
// // // Navigator.push(
// // // context,
// // // MaterialPageRoute(builder: (context) => Accountledger()),
// // // );
// // break;
// //
// // default:
// // print("111");
// // break;
// // }
// },
// child: Container(
// decoration: BoxDecoration(
// color: Colors.white,
// borderRadius: BorderRadius.circular(14),
// ),
// margin: EdgeInsets.symmetric(
// horizontal: 5,
// vertical: 5,
// ),
// padding: EdgeInsets.symmetric(
// horizontal: 10,
// vertical: 15,
// ),
// child: Row(
// children: [
// Expanded(flex: 1, child: SvgIcon),
//
// Expanded(
// flex: 5,
// child: Text(
// "${gridPages[index].pageName}",
// style: TextStyle(fontSize: 14),
// ),
// ),
// Expanded(
// flex: 1,
// child: SvgPicture.asset(
// "assets/svg/arrow_right_new.svg",
// ),
// ),
// ],
// ),
// ),
// );
// },
// ),
Container(
height: MediaQuery.of(context).size.height * 0.2,
margin: EdgeInsets.symmetric(horizontal: 10),
child: Row(
children: [
Expanded(
child: Column(
children: [
Expanded(
child: InkResponse(
onTap: () {},
child: Container(
padding: EdgeInsets.symmetric(horizontal: 5),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(20),
),
child: Row(
children: [
Expanded(
flex: 2,
child: InkResponse(
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder:
(context) => Leadlistbymode(
mode: "executive",
pageTitleName:
"Lead List",
),
),
);
},
child: Container(
padding: EdgeInsets.only(
top: 15,
left: 10,
),
child: Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Text(
"Lead List",
style: TextStyle(
color: AppColors.app_blue,
fontSize: 14,
),
),
Text(
"Product and \nservice orders",
style: TextStyle(
color: AppColors.grey_semi,
fontSize: 12,
),
),
],
),
),
),
),
Expanded(
child: SvgPicture.asset(
"assets/svg/crm/lead_list_ic.svg",
),
),
],
),
),
),
),
SizedBox(height: 10),
Expanded(
child: InkResponse(
child: Container(
padding: EdgeInsets.symmetric(horizontal: 5),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(20),
),
child: Row(
children: [
Expanded(
flex: 2,
child: InkResponse(
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder:
(context) =>
ProspectListByMode(
mode: "executive",
pageTitleName:
"Account List",
),
),
);
},
child: Container(
padding: EdgeInsets.only(
top: 15,
left: 10,
),
child: Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Text(
"Account List",
style: TextStyle(
color: AppColors.app_blue,
fontSize: 14,
),
),
Text(
"Assigned agents, \nperformance",
style: TextStyle(
color: AppColors.grey_semi,
fontSize: 12,
),
),
],
),
),
),
),
Expanded(
child: SvgPicture.asset(
"assets/svg/crm/account_list_ic.svg",
),
),
],
),
),
),
),
],
),
),
SizedBox(width: 10),
Expanded(
child: InkResponse(
onTap: () {},
child: Container(
padding: EdgeInsets.symmetric(
horizontal: 15,
vertical: 15,
),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(20),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start,
children: [
Expanded(
child: Row(
children: [
Expanded(
child: Text(
"Appointment",
style: TextStyle(
color: AppColors.app_blue,
fontSize: 14,
),
),
),
],
),
),
Text(
"Records,\nLedger",
style: TextStyle(
color: AppColors.grey_semi,
fontSize: 12,
),
),
Spacer(),
Expanded(
child: Row(
mainAxisAlignment: MainAxisAlignment.end,
crossAxisAlignment: CrossAxisAlignment.end,
children: [
SvgPicture.asset(
"assets/svg/crm/appointment_calendar_ic.svg",
),
],
),
),
],
),
),
),
),
],
),
),
if (provider.pendingTasksLists.length > 0) ...[
Align(
alignment: Alignment.centerLeft,
child: Padding(
padding: EdgeInsets.only(left: 15, top: 10, right: 15),
child: Row(
children: [
Text(
"Pending Tasks",
style: TextStyle(
fontSize: 16,
color: AppColors.grey_semi,
),
),
if (provider.pendingTasksLists.length > 5) ...[
Spacer(),
SizedBox(
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.start,
children: [
Text(
"View All",
style: TextStyle(
fontFamily: "JakartaMedium",
fontSize: 14,
color: AppColors.app_blue,
),
),
SizedBox(width: 5),
SvgPicture.asset(
"assets/svg/next_button.svg",
),
],
),
),
],
],
),
),
),
Container(
width: double.infinity,
child: ListView.builder(
physics: AlwaysScrollableScrollPhysics(),
shrinkWrap: true,
padding: EdgeInsets.symmetric(
vertical: 5,
horizontal: 10,
),
itemCount: provider.pendingTasksLists.length,
itemBuilder: (context, index) {
final subHeadings = [
provider.pendingTasksLists[index].aname ?? "-",
provider.pendingTasksLists[index].appdate ?? "-",
provider.pendingTasksLists[index].anote ?? "-",
];
return Container(
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(15),
),
margin: EdgeInsets.symmetric(vertical: 3),
padding: EdgeInsets.symmetric(
horizontal: 10,
vertical: 5,
),
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
children: [
...List.generate(3, (j) {
return Container(
padding: EdgeInsets.symmetric(
vertical: 3,
horizontal: 0,
),
child: Column(
children: [
if (j == 2) ...[
Padding(
padding: const EdgeInsets.only(
top: 3.0,
bottom: 3.0,
),
child: DottedLine(
dashGapLength: 4,
dashGapColor: Colors.white,
dashColor: AppColors.grey_semi,
dashLength: 4,
lineThickness: 0.5,
),
),
],
Row(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Expanded(
child: Text(
"${subHeadings[j]}",
style: TextStyle(
color:
j == 0
? AppColors.semi_black
: AppColors.grey_semi,
fontSize: 14,
),
),
),
],
),
],
),
);
}),
],
),
);
},
),
),
],
SizedBox(height: 150),
],
),
),
floatingActionButtonLocation:
FloatingActionButtonLocation.centerFloat,
floatingActionButton: InkResponse(
onTap: () {
if (provider.accessPages
.where((page) => [8, 9].contains(page.id))
.toList()
.contains([8, 9])) {
_showPaymentOptionsSheet(context);
}
},
child: Container(
height: 45,
alignment: Alignment.center,
margin: EdgeInsets.symmetric(horizontal: 10),
padding: EdgeInsets.symmetric(horizontal: 10, vertical: 5),
decoration: BoxDecoration(
color: AppColors.app_blue,
borderRadius: BorderRadius.circular(15),
),
child: Text(
"Add Leads and Prospect",
style: TextStyle(
fontSize: 15,
fontFamily: "JakartaMedium",
color: Colors.white,
),
),
),
),
);
},
);
}
Future<void> _showPaymentOptionsSheet(BuildContext context) {
return showModalBottomSheet(
useSafeArea: true,
isDismissible: true,
isScrollControlled: true,
showDragHandle: true,
backgroundColor: Colors.white,
enableDrag: true,
context: context,
builder: (context) {
return StatefulBuilder(
builder: (context, setState) {
return SafeArea(
child: Consumer<Crmdashboardprovider>(
builder: (context, provider, child) {
final accessiblePagesList =
provider.accessPages
.where((page) => [8, 9].contains(page.id))
.toList();
return Container(
margin: EdgeInsets.only(
bottom: 15,
left: 15,
right: 15,
top: 10,
),
padding: EdgeInsets.only(
bottom: MediaQuery.of(context).viewInsets.bottom,
),
child: SingleChildScrollView(
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
SizedBox(height: 15),
...List.generate(accessiblePagesList.length, (index) {
print(accessiblePagesList[index].mode);
return ListTile(
onTap: () async {
Navigator.pop(context);
var res;
},
leading: SvgPicture.asset(
"assets/svg/fin_ic.svg",
),
title: Text(
"${accessiblePagesList[index].pageName}",
style: TextStyle(
fontSize: 14,
fontFamily: "JakartaMedium",
),
),
trailing: SvgPicture.asset(
"assets/svg/arrow_right_new.svg",
),
);
}),
],
),
),
);
},
),
);
},
);
},
);
}
}
......@@ -571,6 +571,7 @@ class ApiCalling {
'gen_hash_id': (gen_hash_id).toString(),
'location': (location).toString(),
};
print("Tag Loation: ${data}");
var res;
if (attachment != null) {
res = await postImageNew(
......@@ -625,6 +626,31 @@ class ApiCalling {
}
}
static Future<TagGeneratorResponse?> TagGeneratorCheckAPI(
empId,
session,
gen_hash_id,
) async {
try {
Map<String, String> data = {
'emp_id': (empId).toString(),
'session_id': (session).toString(),
'gen_hash_id': (gen_hash_id).toString(),
};
final res = await post(data, genTrackerCheckTagGeneratorUrl, {});
if (res != null) {
// debugPrint(res.body);
return TagGeneratorResponse.fromJson(jsonDecode(res.body));
} else {
debugPrint("Null Response");
return null;
}
} catch (e) {
debugPrint('hello bev=bug $e ');
return null;
}
}
static Future<SubmitComplaintResponse?> SubmitGeneratorComplaintAPI(
empId,
session,
......
......@@ -25,6 +25,7 @@ const genTrackerGeneratorDetailsUrl = "${baseUrl}home/gen_tracker_generator_deta
const genTrackerGeneratorComplaintsUrl = "${baseUrl}home/gen_tracker_generator_complaints_list";
const genTrackerTagLocationUrl = "${baseUrl}home/gen_tracker_tag_location";
const genTrackerTagGeneratorUrl = "${baseUrl}home/gen_tracker_tag_generator";
const genTrackerCheckTagGeneratorUrl = "${baseUrl}home/gen_tracker_check_tag_generator";
const genTrackerRegisterComplaint = "${baseUrl}home/gen_tracker_register_complaint";
///complaint
......
......@@ -45,10 +45,10 @@ packages:
dependency: transitive
description:
name: async
sha256: "758e6d74e971c3e5aceb4110bfd6698efc7f501675bcfe0c775459a8140750eb"
sha256: d2872f9c19731c2e5f10444b14686eb7cc85c76274bd6c16e1816bff9a3bab63
url: "https://pub.dev"
source: hosted
version: "2.13.0"
version: "2.12.0"
auto_size_text:
dependency: "direct main"
description:
......@@ -273,6 +273,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "2.1.1"
dotted_line:
dependency: "direct main"
description:
name: dotted_line
sha256: "41e3d655939559815daa1370fc1e07673a205fa628cf40ce3af45d90029a77b6"
url: "https://pub.dev"
source: hosted
version: "3.2.3"
dropdown_button2:
dependency: "direct main"
description:
......@@ -301,10 +309,10 @@ packages:
dependency: transitive
description:
name: fake_async
sha256: "5368f224a74523e8d2e7399ea1638b37aecfca824a3cc4dfdf77bf1fa905ac44"
sha256: "6a95e56b2449df2273fd8c45a662d6947ce1ebb7aafe80e550a3f68297f3cacc"
url: "https://pub.dev"
source: hosted
version: "1.3.3"
version: "1.3.2"
ffi:
dependency: transitive
description:
......@@ -662,6 +670,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "4.0.0+4"
flutter_staggered_grid_view:
dependency: "direct main"
description:
name: flutter_staggered_grid_view
sha256: "19e7abb550c96fbfeb546b23f3ff356ee7c59a019a651f8f102a4ba9b7349395"
url: "https://pub.dev"
source: hosted
version: "0.7.0"
flutter_svg:
dependency: "direct main"
description:
......@@ -948,26 +964,26 @@ packages:
dependency: transitive
description:
name: leak_tracker
sha256: "8dcda04c3fc16c14f48a7bb586d4be1f0d1572731b6d81d51772ef47c02081e0"
sha256: c35baad643ba394b40aac41080300150a4f08fd0fd6a10378f8f7c6bc161acec
url: "https://pub.dev"
source: hosted
version: "11.0.1"
version: "10.0.8"
leak_tracker_flutter_testing:
dependency: transitive
description:
name: leak_tracker_flutter_testing
sha256: "1dbc140bb5a23c75ea9c4811222756104fbcd1a27173f0c34ca01e16bea473c1"
sha256: f8b613e7e6a13ec79cfdc0e97638fddb3ab848452eff057653abd3edba760573
url: "https://pub.dev"
source: hosted
version: "3.0.10"
version: "3.0.9"
leak_tracker_testing:
dependency: transitive
description:
name: leak_tracker_testing
sha256: "8d5a2d49f4a66b49744b23b018848400d23e54caf9463f4eb20df3eb8acb2eb1"
sha256: "6ba465d5d76e67ddf503e1161d1f4a6bc42306f9d66ca1e8f079a47290fb06d3"
url: "https://pub.dev"
source: hosted
version: "3.0.2"
version: "3.0.1"
lints:
dependency: transitive
description:
......@@ -1673,10 +1689,10 @@ packages:
dependency: transitive
description:
name: vm_service
sha256: ddfa8d30d89985b96407efce8acbdd124701f96741f2d981ca860662f1c0dc02
sha256: "0968250880a6c5fe7edc067ed0a13d4bae1577fe2771dcf3010d52c4a9d3ca14"
url: "https://pub.dev"
source: hosted
version: "15.0.0"
version: "14.3.1"
web:
dependency: transitive
description:
......
......@@ -16,7 +16,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
# In Windows, build-name is used as the major, minor, and patch parts
# of the product and file versions while build-number is used as the build suffix.
version: 1.0.93+97
version: 1.0.94+98
environment:
sdk: ^3.7.2
......@@ -82,6 +82,8 @@ dependencies:
collection: ^1.19.1
auto_size_text: ^3.0.0
app_settings: ^6.1.1
flutter_staggered_grid_view: ^0.7.0
dotted_line: ^3.2.3
dev_dependencies:
flutter_test:
......@@ -113,6 +115,11 @@ flutter:
- assets/
- assets/images/
- assets/svg/
- assets/svg/home/
- assets/svg/finance/
- assets/svg/attendance/
- assets/svg/service/
- assets/svg/crm/
# An image asset can refer to one or more resolution-specific "variants", see
# https://flutter.dev/to/resolution-aware-images
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment