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 { ...@@ -77,6 +77,7 @@ class Generatordetailsprovider extends ChangeNotifier {
ComplaintDescriptionList? _selectedDescriptionType; ComplaintDescriptionList? _selectedDescriptionType;
List<ContactList> get contactsList => _contactList; List<ContactList> get contactsList => _contactList;
List<ScheduleList> get scheduleList => _scheduleList; List<ScheduleList> get scheduleList => _scheduleList;
File? get image => _image; File? get image => _image;
...@@ -114,7 +115,9 @@ class Generatordetailsprovider extends ChangeNotifier { ...@@ -114,7 +115,9 @@ class Generatordetailsprovider extends ChangeNotifier {
String? _selectedDescriptionId; String? _selectedDescriptionId;
bool get submitLoading => _submitLoading; bool get submitLoading => _submitLoading;
bool get showMoreScheduleDetails => _showMoreScheduleDetails; bool get showMoreScheduleDetails => _showMoreScheduleDetails;
bool get showMoreScheduleList => _showMoreScheduleList; bool get showMoreScheduleList => _showMoreScheduleList;
List<ComplaintTypeList> get complaintTypeDropdown => _complaintTypeDropdown; List<ComplaintTypeList> get complaintTypeDropdown => _complaintTypeDropdown;
...@@ -218,6 +221,7 @@ class Generatordetailsprovider extends ChangeNotifier { ...@@ -218,6 +221,7 @@ class Generatordetailsprovider extends ChangeNotifier {
_showMoreScheduleList = value; _showMoreScheduleList = value;
notifyListeners(); notifyListeners();
} }
set showMoreScheduleDetails(bool value) { set showMoreScheduleDetails(bool value) {
_showMoreScheduleDetails = value; _showMoreScheduleDetails = value;
notifyListeners(); notifyListeners();
...@@ -289,7 +293,11 @@ class Generatordetailsprovider extends ChangeNotifier { ...@@ -289,7 +293,11 @@ class Generatordetailsprovider extends ChangeNotifier {
_selectedDescriptionId = ""; _selectedDescriptionId = "";
_selectedDescription = ""; _selectedDescription = "";
_qrViewController!.dispose(); _qrViewController!.dispose();
_imageName = null;
_image = null;
_imagePicked = 0;
_imageError = null;
notifyListeners();
} }
initialFunction(from) async { initialFunction(from) async {
...@@ -543,8 +551,8 @@ class Generatordetailsprovider extends ChangeNotifier { ...@@ -543,8 +551,8 @@ class Generatordetailsprovider extends ChangeNotifier {
_cmsngDate = data.cmsngDate; _cmsngDate = data.cmsngDate;
_status = data.status; _status = data.status;
_genLocation = data.loc; _genLocation = data.loc;
_contactList = data.contactList??[]; _contactList = data.contactList ?? [];
_scheduleList = data.scheduleList??[]; _scheduleList = data.scheduleList ?? [];
_complaintTypeDropdown = data.complaintTypeList ?? []; _complaintTypeDropdown = data.complaintTypeList ?? [];
_complaintCategorydropdown = data.complaintCategoryList ?? []; _complaintCategorydropdown = data.complaintCategoryList ?? [];
_complaintDescriptionDropdown = data.complaintDescriptionList ?? []; _complaintDescriptionDropdown = data.complaintDescriptionList ?? [];
...@@ -795,7 +803,7 @@ class Generatordetailsprovider extends ChangeNotifier { ...@@ -795,7 +803,7 @@ class Generatordetailsprovider extends ChangeNotifier {
]) async { ]) async {
_submitLoading = true; _submitLoading = true;
notifyListeners(); notifyListeners();
if (!valid()) { if (!valid(context)) {
return; return;
} }
try { try {
...@@ -855,11 +863,19 @@ class Generatordetailsprovider extends ChangeNotifier { ...@@ -855,11 +863,19 @@ class Generatordetailsprovider extends ChangeNotifier {
} }
} }
bool valid() { bool valid(context) {
bool isValid = true; bool isValid = true;
if (_image == null || _imagePicked == 0) { if (_image == null || _imagePicked == 0) {
_imageError = "Please Add Proof"; _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(); notifyListeners();
return isValid; return isValid;
...@@ -944,6 +960,67 @@ class Generatordetailsprovider extends ChangeNotifier { ...@@ -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 { imgFromCamera() async {
// Capture a photo // Capture a photo
try { try {
......
...@@ -25,15 +25,25 @@ class HomescreenNotifier extends ChangeNotifier { ...@@ -25,15 +25,25 @@ class HomescreenNotifier extends ChangeNotifier {
String? _onlineStatus = "Offline"; String? _onlineStatus = "Offline";
String get username => _username; String get username => _username;
String get email => _email; String get email => _email;
String get curdate => _curdate; String get curdate => _curdate;
String get empId => _empId; String get empId => _empId;
String get session => _session; String get session => _session;
String get webPageUrl => _webPageUrl; String get webPageUrl => _webPageUrl;
String get whizzdomPageUrl => _whizzdomPageUrl; String get whizzdomPageUrl => _whizzdomPageUrl;
String get roleStatus => _roleStatus; String get roleStatus => _roleStatus;
int get att_status => _att_status; int get att_status => _att_status;
get Sessionid => _Sessionid; get Sessionid => _Sessionid;
String? get onlineStatus => _onlineStatus; String? get onlineStatus => _onlineStatus;
WebSocketManager webSocketManager = WebSocketManager( WebSocketManager webSocketManager = WebSocketManager(
......
...@@ -9,63 +9,88 @@ import '../../Models/crmModels/crmUniversalSearchResponse.dart'; ...@@ -9,63 +9,88 @@ import '../../Models/crmModels/crmUniversalSearchResponse.dart';
import '../../services/api_calling.dart'; import '../../services/api_calling.dart';
import '../HomeScreenNotifier.dart'; import '../HomeScreenNotifier.dart';
class Crmdashboardprovider extends ChangeNotifier{ class Crmdashboardprovider extends ChangeNotifier {
TextEditingController searchController = TextEditingController(); TextEditingController searchController = TextEditingController();
List<PagesAccessible> _accessPages = []; List<PagesAccessible> _accessPages = [];
List<PagesAccessible> get accessPages => _accessPages; List<PagesAccessible> get accessPages => _accessPages;
List<PendingTasks> _pendingTasks = []; List<PendingTasks> _pendingTasks = [];
List<PendingTasks> get pendingTasksLists => _pendingTasks; List<PendingTasks> get pendingTasksLists => _pendingTasks;
List<Accounts> _accountsList = []; List<Accounts> _accountsList = [];
List<Leads> _leadsList = []; List<Leads> _leadsList = [];
List<Enquires> _enquiresList = []; List<Enquires> _enquiresList = [];
List<Accounts> get accountsList => _accountsList; List<Accounts> get accountsList => _accountsList;
List<Leads> get leadsList => _leadsList; List<Leads> get leadsList => _leadsList;
List<Enquires> get enquiresList => _enquiresList; List<Enquires> get enquiresList => _enquiresList;
Hotleads _hotleads = Hotleads(); Hotleads _hotleads = Hotleads();
Hotleads get hotleads => _hotleads; Hotleads get hotleads => _hotleads;
Hotleads _coldleads = Hotleads(); Hotleads _coldleads = Hotleads();
Hotleads get coldleads => _coldleads; Hotleads get coldleads => _coldleads;
Hotleads _warmleads = Hotleads(); Hotleads _warmleads = Hotleads();
Hotleads get warmleads => _warmleads; Hotleads get warmleads => _warmleads;
Hotleads _totalleads = Hotleads(); Hotleads _totalleads = Hotleads();
Hotleads get totalleads => _totalleads; Hotleads get totalleads => _totalleads;
Hotleads _orderlost = Hotleads(); Hotleads _orderlost = Hotleads();
Hotleads get orderlost => _orderlost; Hotleads get orderlost => _orderlost;
Hotleads _norequirement = Hotleads(); Hotleads _norequirement = Hotleads();
Hotleads get norequirement => _norequirement; Hotleads get norequirement => _norequirement;
Hotleads _openEnquiries = Hotleads(); Hotleads _openEnquiries = Hotleads();
Hotleads get openEnquiries => _openEnquiries; Hotleads get openEnquiries => _openEnquiries;
List<Hotleads> _allLeads = []; List<Hotleads> _allLeads = [];
List<Hotleads> get allLeads => _allLeads; List<Hotleads> get allLeads => _allLeads;
Future<void>accessPagesAPIFunction(context) async { Future<void> accessPagesAPIFunction(context) async {
try{ try {
var HomeProv = Provider.of<HomescreenNotifier>(context,listen: false); var HomeProv = Provider.of<HomescreenNotifier>(context, listen: false);
final data = await ApiCalling.crmAccessiblePagesAPI(HomeProv.empId, HomeProv.session); final data = await ApiCalling.crmAccessiblePagesAPI(
if(data!=null){ HomeProv.empId,
if(data.error=="0"){ HomeProv.session,
);
if (data != null) {
if (data.error == "0") {
_accessPages = data.pagesAccessible!; _accessPages = data.pagesAccessible!;
_accessPages.add(PagesAccessible(mode: "",id: 0,pageName: "Nearby Leads")); _accessPages.add(
PagesAccessible(mode: "", id: 0, pageName: "Nearby Leads"),
);
notifyListeners(); notifyListeners();
} }
} }
} catch (e, s) {}
}catch (e,s){
}
} }
Future<void> crmDashboardAPIFunction(context, mode, Future<void> crmDashboardAPIFunction(
from,to,teamemployee) async { context,
try{ mode,
var HomeProv = Provider.of<HomescreenNotifier>(context,listen: false); from,
final data = await ApiCalling.crmDashboardAPI(HomeProv.empId, HomeProv.session, mode, to,
from,to,teamemployee); teamemployee,
if(data!=null){ ) async {
if(data.error=="0"){ 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!; _hotleads = data.hotleads!;
_coldleads = data.coldleads!; _coldleads = data.coldleads!;
_warmleads = data.warmleads!; _warmleads = data.warmleads!;
...@@ -85,45 +110,41 @@ class Crmdashboardprovider extends ChangeNotifier{ ...@@ -85,45 +110,41 @@ class Crmdashboardprovider extends ChangeNotifier{
notifyListeners(); notifyListeners();
} }
} }
} catch (e, s) {}
}catch (e,s){
}
} }
Future<void> crmPendingTasksAPIFunction(context) async {
Future<void> crmPendingTasksAPIFunction(context) async { try {
try{ var HomeProv = Provider.of<HomescreenNotifier>(context, listen: false);
var HomeProv = Provider.of<HomescreenNotifier>(context,listen: false); final data = await ApiCalling.crmPendingTasksAPI(
final data = await ApiCalling.crmPendingTasksAPI(HomeProv.empId, HomeProv.session); HomeProv.empId,
if(data!=null){ HomeProv.session,
if(data.error=="0"){ );
if (data != null) {
if (data.error == "0") {
_pendingTasks = data.pendingTasks!; _pendingTasks = data.pendingTasks!;
notifyListeners(); notifyListeners();
} }
} }
} catch (e, s) {}
}catch (e,s){
}
} }
Future<void> crmUniversalSearchFunction(context) async { Future<void> crmUniversalSearchFunction(context) async {
try{ try {
var HomeProv = Provider.of<HomescreenNotifier>(context,listen: false); var HomeProv = Provider.of<HomescreenNotifier>(context, listen: false);
final data = await ApiCalling.crmUniversalSearchAPI(HomeProv.empId, HomeProv.session,searchController.text); final data = await ApiCalling.crmUniversalSearchAPI(
if(data!=null){ HomeProv.empId,
if(data.error=="0"){ HomeProv.session,
_accountsList = data.accounts??[]; searchController.text,
_leadsList = data.leads??[]; );
_enquiresList = data.enquires??[]; if (data != null) {
if (data.error == "0") {
_accountsList = data.accounts ?? [];
_leadsList = data.leads ?? [];
_enquiresList = data.enquires ?? [];
notifyListeners(); notifyListeners();
} }
} }
} catch (e, s) {}
}catch (e,s){
}
} }
}
}
\ No newline at end of file
...@@ -12,7 +12,8 @@ class AppColors { ...@@ -12,7 +12,8 @@ class AppColors {
static Color cyan_blue = Color(0xFF219EBC); static Color cyan_blue = Color(0xFF219EBC);
static Color profile_card_gradient1 = Color(0xFFCFEEFF); static Color profile_card_gradient1 = Color(0xFFCFEEFF);
static Color profile_card_gradient2 = Color(0xFF97D9FF); 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 button_disabled = Color(0xFFBEE5FB);
static Color text_field_color = Color(0xFFF0F4F5); static Color text_field_color = Color(0xFFF0F4F5);
static Color overlay_box_color = Color(0xFFE6F6FF); static Color overlay_box_color = Color(0xFFE6F6FF);
......
...@@ -42,6 +42,43 @@ PreferredSizeWidget appbar(BuildContext context, title) { ...@@ -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) { PreferredSizeWidget appbar2(BuildContext context, title, reset, widget) {
return AppBar( return AppBar(
automaticallyImplyLeading: false, automaticallyImplyLeading: false,
...@@ -91,6 +128,56 @@ PreferredSizeWidget appbar2(BuildContext context, title, reset, widget) { ...@@ -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 { Future<bool> onBackPressed(BuildContext context) async {
Navigator.pop(context, true); Navigator.pop(context, true);
return true; return true;
......
...@@ -30,7 +30,6 @@ class _AttendanceScreenState extends State<AttendanceScreen> { ...@@ -30,7 +30,6 @@ class _AttendanceScreenState extends State<AttendanceScreen> {
super.initState(); super.initState();
_connectivity.initialise(); _connectivity.initialise();
_connectivity.myStream.listen((source) { _connectivity.myStream.listen((source) {
setState(() => _source = source); setState(() => _source = source);
}); });
homeProvider = Provider.of<HomescreenNotifier>(context, listen: false); homeProvider = Provider.of<HomescreenNotifier>(context, listen: false);
...@@ -41,7 +40,6 @@ class _AttendanceScreenState extends State<AttendanceScreen> { ...@@ -41,7 +40,6 @@ class _AttendanceScreenState extends State<AttendanceScreen> {
}); });
} }
@override @override
void dispose() { void dispose() {
// TODO: implement dispose // TODO: implement dispose
...@@ -64,11 +62,16 @@ class _AttendanceScreenState extends State<AttendanceScreen> { ...@@ -64,11 +62,16 @@ class _AttendanceScreenState extends State<AttendanceScreen> {
} }
return (connection == 'Online') return (connection == 'Online')
? Platform.isAndroid ? Platform.isAndroid
? WillPopScope( ? WillPopScope(
onWillPop: () => onBackPressed(context), onWillPop: () => onBackPressed(context),
child: SafeArea(top: false, bottom: true, child: _scaffold(context)), child: SafeArea(
) top: false,
: _scaffold(context):NoNetwork(context); bottom: true,
child: _scaffold(context),
),
)
: _scaffold(context)
: NoNetwork(context);
} }
Widget _scaffold(BuildContext context) { Widget _scaffold(BuildContext context) {
...@@ -144,17 +147,18 @@ class _AttendanceScreenState extends State<AttendanceScreen> { ...@@ -144,17 +147,18 @@ class _AttendanceScreenState extends State<AttendanceScreen> {
child: Scaffold( child: Scaffold(
resizeToAvoidBottomInset: true, resizeToAvoidBottomInset: true,
backgroundColor: AppColors.scaffold_bg_color, backgroundColor: AppColors.scaffold_bg_color,
appBar: appbar(context, "Attendance"), appBar: appbarNew(context, "Attendance", 0xFFFFFFFF),
body: Container( body: Container(
child: SingleChildScrollView( child: SingleChildScrollView(
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Container( Container(
margin: EdgeInsets.only(top: 15, bottom: 15),
decoration: BoxDecoration( decoration: BoxDecoration(
color: Colors.white, color: Colors.white,
borderRadius: BorderRadius.circular(16), borderRadius: BorderRadius.vertical(
bottom: Radius.circular(20),
),
), ),
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
...@@ -166,16 +170,36 @@ class _AttendanceScreenState extends State<AttendanceScreen> { ...@@ -166,16 +170,36 @@ class _AttendanceScreenState extends State<AttendanceScreen> {
top: 15, top: 15,
), ),
child: Row( child: Row(
children: [ children: List.generate(2, (j) {
Expanded(child: Text("Check-in")), final heads = ["Check-in", "Check-out"];
Expanded(child: Text("Check-out")), return Expanded(
], child: Text(
"Check-in",
style: TextStyle(
color: AppColors.grey_thick,
fontSize: 14,
fontFamily: "JakartaMedium",
),
),
);
}),
), ),
), ),
SizedBox( SizedBox(
child: Row( child: Row(
children: [ children: List.generate(2, (iii) {
Expanded( 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( child: Container(
padding: EdgeInsets.symmetric( padding: EdgeInsets.symmetric(
horizontal: 10, horizontal: 10,
...@@ -183,11 +207,11 @@ class _AttendanceScreenState extends State<AttendanceScreen> { ...@@ -183,11 +207,11 @@ class _AttendanceScreenState extends State<AttendanceScreen> {
), ),
margin: EdgeInsets.symmetric( margin: EdgeInsets.symmetric(
horizontal: 10, horizontal: 10,
vertical: 15, vertical: 5,
), ),
decoration: BoxDecoration( decoration: BoxDecoration(
color: Color(0xFFF3EDFF), color: Color(0xFFF3EDFF),
borderRadius: BorderRadius.circular(16), borderRadius: BorderRadius.circular(20),
), ),
child: Column( child: Column(
crossAxisAlignment: crossAxisAlignment:
...@@ -197,191 +221,164 @@ class _AttendanceScreenState extends State<AttendanceScreen> { ...@@ -197,191 +221,164 @@ class _AttendanceScreenState extends State<AttendanceScreen> {
text: TextSpan( text: TextSpan(
children: [ children: [
TextSpan( TextSpan(
text: formattedTime, text: times[iii],
style: TextStyle( style: TextStyle(
color: color:
formattedTime != "-" times[iii] != "-"
? Color(0xFF493272) ? Color(0xFF1286C7)
: Color(0xFFED3424), : Color(0xFFED3424),
fontFamily: "JakartaRegular", fontFamily: "JakartaRegular",
fontSize: 30, fontSize: 20,
), ),
), ),
TextSpan( TextSpan(
text: period, text: periods[iii],
style: TextStyle( style: TextStyle(
color: color:
period != "-" periods[iii] != "-"
? Color(0xFF493272) ? Color(0xFF1286C7)
: Color(0xFFED3424), : Color(0xFFED3424),
fontFamily: "JakartaRegular", fontFamily: "JakartaRegular",
fontSize: 14,
), ),
), ),
], ],
), ),
), ),
SizedBox(height: 10),
Text( Text(
"${attendance.attendanceHistory.firstOrNull?['check_in_location']}", locations[iii],
style: TextStyle( style: TextStyle(
color: Color(0xFF818181), color: AppColors.semi_black,
fontSize: 12,
), ),
), ),
], ],
), ),
), ),
), );
Expanded( }),
child: Container( ),
padding: EdgeInsets.symmetric( ),
horizontal: 10,
vertical: 15, Container(
), padding: EdgeInsets.only(left: 10, top: 10),
margin: EdgeInsets.symmetric( child: Text(
horizontal: 10, "Attendance Details",
vertical: 15, style: TextStyle(
), fontFamily: "JakartaMedium",
decoration: BoxDecoration( fontSize: 14,
color: Color(0xFFF3EDFF), color: Color(0xFF818181),
borderRadius: BorderRadius.circular(16), ),
), ),
child: Column( ),
crossAxisAlignment: Container(
CrossAxisAlignment.start, padding: EdgeInsets.symmetric(
children: [ horizontal: 10,
RichText( vertical: 10,
text: TextSpan( ),
children: [
TextSpan( child: GridView.builder(
text: formattedTime2, itemCount: 4,
style: TextStyle( shrinkWrap: true,
color: physics: NeverScrollableScrollPhysics(),
formattedTime2 != "-" gridDelegate:
? Color(0xFF493272) SliverGridDelegateWithFixedCrossAxisCount(
: Color(0xFFED3424), crossAxisCount: 2,
fontFamily: "JakartaRegular", crossAxisSpacing: 10,
fontSize: 30, mainAxisSpacing: 10,
), childAspectRatio: 20 / 10,
), ),
TextSpan( itemBuilder: (context, index) {
text: period2, final numbers = [
style: TextStyle( attendance.presentDays,
color: attendance.absentDays,
period2 != "-" attendance.holidays,
? Color(0xFF493272) attendance.latePenalties,
: Color(0xFFED3424), ];
fontFamily: "JakartaRegular", 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,
), ),
], ),
), ),
), Expanded(
Text( flex: 1,
"${attendance.attendanceHistory.firstOrNull?['check_out_location']}", child: SvgPicture.asset(
style: TextStyle( assetNames[index],
color: Color(0xFF818181), ),
), ),
), ],
], ),
), ],
), ),
), );
], },
), ),
), ),
], ],
), ),
), ),
Container( SizedBox(height: 15),
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)),
),
],
),
);
},
),
),
///calendar ///calendar
Container( Container(
// padding: EdgeInsets.symmetric(horizontal: 10,vertical: 5), // padding: EdgeInsets.symmetric(horizontal: 10,vertical: 5),
margin: EdgeInsets.symmetric(horizontal: 10, vertical: 5), margin: EdgeInsets.symmetric(
horizontal: 15,
vertical: 10,
),
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.circular(16), borderRadius: BorderRadius.circular(16),
color: Colors.white, color: Colors.white,
...@@ -612,7 +609,7 @@ class _AttendanceScreenState extends State<AttendanceScreen> { ...@@ -612,7 +609,7 @@ class _AttendanceScreenState extends State<AttendanceScreen> {
? Color(0xFFFFFFFF) ? Color(0xFFFFFFFF)
: dateColor == 'g' : dateColor == 'g'
? Color( ? Color(
0xFF6B3A02, 0xFFE7FFE5,
).withAlpha(50) ).withAlpha(50)
: dateColor == 'r' : dateColor == 'r'
? Color( ? Color(
...@@ -643,7 +640,7 @@ class _AttendanceScreenState extends State<AttendanceScreen> { ...@@ -643,7 +640,7 @@ class _AttendanceScreenState extends State<AttendanceScreen> {
index)) index))
? Color(0xFF2D2D2D) ? Color(0xFF2D2D2D)
: dateColor == 'g' : dateColor == 'g'
? Color(0xFF6B3A02) ? Color(0xFF0D9C00)
: dateColor == 'r' : dateColor == 'r'
? Color(0xFFFF0000) ? Color(0xFFFF0000)
: dateColor == 'b' : dateColor == 'b'
...@@ -670,61 +667,69 @@ class _AttendanceScreenState extends State<AttendanceScreen> { ...@@ -670,61 +667,69 @@ class _AttendanceScreenState extends State<AttendanceScreen> {
], ],
), ),
), ),
SizedBox(height: 70), SizedBox(height: 25),
], ],
), ),
), ),
), ),
floatingActionButton: bottomNavigationBar:
attendance.attendanceStatus == 0 || attendance.attendanceStatus == 0 ||
attendance.attendanceStatus == 1 attendance.attendanceStatus == 1
? Align( ? Container(
alignment: Alignment.bottomCenter, height: 75,
child: InkWell( decoration: BoxDecoration(color: Colors.white),
onTap: () async { padding: EdgeInsets.symmetric(vertical: 10),
var res = await Navigator.push( child: Align(
context, alignment: Alignment.center,
MaterialPageRoute( child: InkWell(
builder: onTap: () async {
(context) => CheckInOutScreen( var res = await Navigator.push(
getAttendanceStatus:
attendance.attendanceStatus,
),
),
);
if (res == true) {
attendance.getAttendanceList(homeProvider, context);
attendance.init(homeProvider, context);
attendance.loadAttendanceDetails(
homeProvider,
context, context,
MaterialPageRoute(
builder:
(context) => CheckInOutScreen(
getAttendanceStatus:
attendance.attendanceStatus,
),
),
); );
} if (res == true) {
attendance.getAttendanceList(
var f = FocusScope.of(context); homeProvider,
if (!f.hasPrimaryFocus) { context,
f.unfocus(); );
} attendance.init(homeProvider, context);
}, attendance.loadAttendanceDetails(
child: Container( homeProvider,
alignment: Alignment.bottomCenter, context,
height: 45, );
margin: EdgeInsets.symmetric(horizontal: 10), }
width: MediaQuery.of(context).size.width,
decoration: BoxDecoration( var f = FocusScope.of(context);
color: AppColors.app_blue, if (!f.hasPrimaryFocus) {
borderRadius: BorderRadius.circular(15.0), f.unfocus();
), }
child: Center( },
child: Text( child: Container(
attendance.attendanceStatus == 0 alignment: Alignment.bottomCenter,
? "Check In" height: 45,
: "Check Out", margin: EdgeInsets.symmetric(horizontal: 10),
textAlign: TextAlign.center, width: MediaQuery.of(context).size.width,
style: TextStyle( decoration: BoxDecoration(
fontSize: 16, color: AppColors.app_blue,
color: Colors.white, borderRadius: BorderRadius.circular(15.0),
fontFamily: "JakartaMedium", ),
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> { ...@@ -796,14 +801,14 @@ class _AttendanceScreenState extends State<AttendanceScreen> {
itemBuilder: (context, index) { itemBuilder: (context, index) {
final colors = [ final colors = [
Color(0xFF493272).withAlpha(50), Color(0xFF493272).withAlpha(50),
Color(0xFF6B3A02).withAlpha(50), Color(0xFFE7FFE5),
Color(0xFFFF0000).withAlpha(50), Color(0xFFFF0000).withAlpha(50),
Color(0xFFFFE8D0), Color(0xFFFFE8D0),
Color(0xFFFFF9B2), Color(0xFFFFF9B2),
]; ];
final text_colors = [ final text_colors = [
Color(0xFF493272), Color(0xFF493272),
Color(0xFF6B3A02), Color(0xFF0D9C00),
Color(0xFFFF0000), Color(0xFFFF0000),
Color(0xFF6B3A02), Color(0xFF6B3A02),
Color(0xFF605C00), Color(0xFF605C00),
......
...@@ -345,7 +345,7 @@ class _WebErpScreenState extends State<WebErpScreen> { ...@@ -345,7 +345,7 @@ class _WebErpScreenState extends State<WebErpScreen> {
print(uri); print(uri);
print(uri.scheme); print(uri.scheme);
if (uri.toString().contains( if (uri.toString().contains(
'file_viewer_n ame.php', 'file_viewer_name.php',
) && ) &&
uri.toString().contains('.pdf')) { uri.toString().contains('.pdf')) {
final pdfPath = final pdfPath =
......
...@@ -19,12 +19,14 @@ class Universalsearchscreen extends StatefulWidget { ...@@ -19,12 +19,14 @@ class Universalsearchscreen extends StatefulWidget {
} }
class _UniversalsearchscreenState extends State<Universalsearchscreen> { class _UniversalsearchscreenState extends State<Universalsearchscreen> {
FocusNode focusNode = FocusNode();
@override @override
void initState() { void initState() {
super.initState(); super.initState();
WidgetsBinding.instance.addPostFrameCallback((timeStamp) { WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
var prov = Provider.of<Crmdashboardprovider>(context, listen: false); var prov = Provider.of<Crmdashboardprovider>(context, listen: false);
prov.crmUniversalSearchFunction(context); // prov.crmUniversalSearchFunction(context);
}); });
} }
...@@ -36,24 +38,131 @@ class _UniversalsearchscreenState extends State<Universalsearchscreen> { ...@@ -36,24 +38,131 @@ class _UniversalsearchscreenState extends State<Universalsearchscreen> {
onWillPop: () => onBackPressed(context), onWillPop: () => onBackPressed(context),
child: SafeArea( child: SafeArea(
top: false, top: false,
bottom: Platform.isIOS?false:true, bottom: Platform.isIOS ? false : true,
child: Scaffold( child: Scaffold(
resizeToAvoidBottomInset: true, resizeToAvoidBottomInset: true,
backgroundColor: AppColors.scaffold_bg_color, backgroundColor: AppColors.scaffold_bg_color,
appBar: appbar(context, "Search"), appBar: appbarNew(context, "Search", 0xFFFFFFFF),
body: SingleChildScrollView( body: SingleChildScrollView(
child: Column( child: Column(
children: [ 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) ...[ if (provider.accountsList.length > 0) ...[
Align( Align(
alignment: Alignment.centerLeft, alignment: Alignment.centerLeft,
child: Padding( child: Padding(
padding: EdgeInsets.symmetric(horizontal: 6), padding: EdgeInsets.symmetric(horizontal: 10),
child: Text( child: Text(
"Accounts", "Accounts",
style: TextStyle( style: TextStyle(
fontSize: 16, fontSize: 16,
color: AppColors.grey_semi, color: AppColors.grey_thick,
), ),
), ),
), ),
...@@ -62,26 +171,84 @@ class _UniversalsearchscreenState extends State<Universalsearchscreen> { ...@@ -62,26 +171,84 @@ class _UniversalsearchscreenState extends State<Universalsearchscreen> {
physics: NeverScrollableScrollPhysics(), physics: NeverScrollableScrollPhysics(),
shrinkWrap: true, shrinkWrap: true,
padding: EdgeInsets.symmetric( padding: EdgeInsets.symmetric(
vertical: 10, vertical: 5,
horizontal: 10, horizontal: 5,
), ),
itemCount: provider.accountsList.length, itemCount: provider.accountsList.length,
itemBuilder: (context, index) { 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( return InkResponse(
onTap: () { onTap: () {
Navigator.pushAndRemoveUntil( Navigator.pushAndRemoveUntil(
context, context,
MaterialPageRoute( MaterialPageRoute(
builder: (context) => ProspectDetailsByMode( builder:
pageTitleName: "Account Details", (context) => ProspectDetailsByMode(
mode: "Executive", pageTitleName: "Account Details",
leadId: provider.accountsList[index].aid, 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( child: Container(
decoration: BoxDecoration( decoration: BoxDecoration(
...@@ -96,19 +263,24 @@ class _UniversalsearchscreenState extends State<Universalsearchscreen> { ...@@ -96,19 +263,24 @@ class _UniversalsearchscreenState extends State<Universalsearchscreen> {
top: 5, top: 5,
), ),
padding: EdgeInsets.only( padding: EdgeInsets.only(
bottom: MediaQuery.of(context).viewInsets.bottom, bottom:
MediaQuery.of(context).viewInsets.bottom,
), ),
child: ListTile( child: ListTile(
title: Text( leading: SvgPicture.asset(
provider.accountsList[index].aname!, "assets/svg/crm/crm_search_list_ic.svg",
style: TextStyle( ),
title:RichText(text: TextSpan(
children: textSpans,
style: TextStyle(
color: AppColors.semi_black,
fontSize: 12, // Highlight color
fontFamily: "JakartaMedium", fontFamily: "JakartaMedium",
fontSize: 14,
), ),
), )),
trailing: SvgPicture.asset( // trailing: SvgPicture.asset(
"assets/svg/arrow_right_new.svg", // "assets/svg/arrow_right_new.svg",
), // ),
), ),
), ),
); );
...@@ -120,12 +292,12 @@ class _UniversalsearchscreenState extends State<Universalsearchscreen> { ...@@ -120,12 +292,12 @@ class _UniversalsearchscreenState extends State<Universalsearchscreen> {
Align( Align(
alignment: Alignment.centerLeft, alignment: Alignment.centerLeft,
child: Padding( child: Padding(
padding: EdgeInsets.symmetric(horizontal: 6), padding: EdgeInsets.symmetric(horizontal: 10),
child: Text( child: Text(
"Leads", "Leads",
style: TextStyle( style: TextStyle(
fontSize: 16, fontSize: 16,
color: AppColors.grey_semi, color: AppColors.grey_thick,
), ),
), ),
), ),
...@@ -134,24 +306,82 @@ class _UniversalsearchscreenState extends State<Universalsearchscreen> { ...@@ -134,24 +306,82 @@ class _UniversalsearchscreenState extends State<Universalsearchscreen> {
physics: NeverScrollableScrollPhysics(), physics: NeverScrollableScrollPhysics(),
shrinkWrap: true, shrinkWrap: true,
padding: EdgeInsets.symmetric( padding: EdgeInsets.symmetric(
vertical: 10, vertical: 5,
horizontal: 10, horizontal: 5,
), ),
itemCount: provider.leadsList.length, itemCount: provider.leadsList.length,
itemBuilder: (context, index) { 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( return InkResponse(
onTap: () { onTap: () {
Navigator.pushAndRemoveUntil( Navigator.pushAndRemoveUntil(
context, context,
MaterialPageRoute( MaterialPageRoute(
builder: (context) => ProspectDetailsByMode( builder:
pageTitleName: "Lead Details", (context) => ProspectDetailsByMode(
mode: "Executive", pageTitleName: "Lead Details",
leadId: provider.leadsList[index].lid, 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( child: Container(
...@@ -167,19 +397,24 @@ class _UniversalsearchscreenState extends State<Universalsearchscreen> { ...@@ -167,19 +397,24 @@ class _UniversalsearchscreenState extends State<Universalsearchscreen> {
top: 5, top: 5,
), ),
padding: EdgeInsets.only( padding: EdgeInsets.only(
bottom: MediaQuery.of(context).viewInsets.bottom, bottom:
MediaQuery.of(context).viewInsets.bottom,
), ),
child: ListTile( child: ListTile(
title: Text( leading: SvgPicture.asset(
provider.leadsList[index].aname!, "assets/svg/crm/crm_search_list_ic.svg",
style: TextStyle( ),
title: RichText(text: TextSpan(
children: textSpans,
style: TextStyle(
color: AppColors.semi_black,
fontSize: 12, // Highlight color
fontFamily: "JakartaMedium", fontFamily: "JakartaMedium",
fontSize: 14,
), ),
), )),
trailing: SvgPicture.asset( // trailing: SvgPicture.asset(
"assets/svg/arrow_right_new.svg", // "assets/svg/arrow_right_new.svg",
), // ),
), ),
), ),
); );
...@@ -190,12 +425,12 @@ class _UniversalsearchscreenState extends State<Universalsearchscreen> { ...@@ -190,12 +425,12 @@ class _UniversalsearchscreenState extends State<Universalsearchscreen> {
Align( Align(
alignment: Alignment.centerLeft, alignment: Alignment.centerLeft,
child: Padding( child: Padding(
padding: EdgeInsets.symmetric(horizontal: 6), padding: EdgeInsets.symmetric(horizontal: 10),
child: Text( child: Text(
"Enquiries", "Enquiries",
style: TextStyle( style: TextStyle(
fontSize: 16, fontSize: 16,
color: AppColors.grey_semi, color: AppColors.grey_thick,
), ),
), ),
), ),
...@@ -204,11 +439,72 @@ class _UniversalsearchscreenState extends State<Universalsearchscreen> { ...@@ -204,11 +439,72 @@ class _UniversalsearchscreenState extends State<Universalsearchscreen> {
physics: NeverScrollableScrollPhysics(), physics: NeverScrollableScrollPhysics(),
shrinkWrap: true, shrinkWrap: true,
padding: EdgeInsets.symmetric( padding: EdgeInsets.symmetric(
vertical: 10, vertical: 5,
horizontal: 10, horizontal: 5,
), ),
itemCount: provider.enquiresList.length, itemCount: provider.enquiresList.length,
itemBuilder: (context, index) { 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( return Container(
decoration: BoxDecoration( decoration: BoxDecoration(
color: Colors.white, color: Colors.white,
...@@ -225,18 +521,29 @@ class _UniversalsearchscreenState extends State<Universalsearchscreen> { ...@@ -225,18 +521,29 @@ class _UniversalsearchscreenState extends State<Universalsearchscreen> {
bottom: MediaQuery.of(context).viewInsets.bottom, bottom: MediaQuery.of(context).viewInsets.bottom,
), ),
child: ListTile( child: ListTile(
title: Text( leading: SvgPicture.asset(
provider.enquiresList[index].companyName == "" "assets/svg/crm/crm_search_list_ic.svg",
? provider.enquiresList[index].name! ),
: provider.enquiresList[index].companyName!, // title: Text(
style: TextStyle( // 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", fontFamily: "JakartaMedium",
fontSize: 14,
), ),
), )),
trailing: SvgPicture.asset( // trailing: SvgPicture.asset(
"assets/svg/arrow_right_new.svg", // "assets/svg/arrow_right_new.svg",
), // ),
), ),
); );
}, },
......
...@@ -2,6 +2,7 @@ import 'dart:io'; ...@@ -2,6 +2,7 @@ import 'dart:io';
import 'package:connectivity_plus/connectivity_plus.dart'; import 'package:connectivity_plus/connectivity_plus.dart';
import 'package:flutter/material.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:flutter_svg/svg.dart';
import 'package:generp/Notifiers/commonProvider/accountsListProvider.dart'; import 'package:generp/Notifiers/commonProvider/accountsListProvider.dart';
import 'package:generp/Notifiers/financeProvider/DashboardProvider.dart'; import 'package:generp/Notifiers/financeProvider/DashboardProvider.dart';
...@@ -79,133 +80,580 @@ class _FinancedashboardState extends State<Financedashboard> { ...@@ -79,133 +80,580 @@ class _FinancedashboardState extends State<Financedashboard> {
return Consumer<Dashboardprovider>( return Consumer<Dashboardprovider>(
builder: (context, provider, child) { builder: (context, provider, child) {
final pages = provider.accessiblePagesList; 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( return Scaffold(
resizeToAvoidBottomInset: true, resizeToAvoidBottomInset: true,
backgroundColor: AppColors.scaffold_bg_color, backgroundColor: AppColors.scaffold_bg_color,
// appBar: appbarNew(context, "Finance",0xFFCEEDFF),
appBar: appbar(context, "Finance"), appBar: appbar(context, "Finance"),
body: SizedBox( body: SizedBox(
child: SingleChildScrollView( child: SingleChildScrollView(
child: Column( child: Column(
children: [ children: [
ListView.builder( // Container(
itemCount: pages.length, // height: 200,
shrinkWrap: true, // decoration: BoxDecoration(
physics: NeverScrollableScrollPhysics(), // image: DecorationImage(image: AssetImage(
itemBuilder: (context, index) { // "assets/svg/finance/main_dashboard.png",
Widget? SvgIcon; // ), fit: BoxFit.contain,),
switch (pages[index].mode) { // gradient: LinearGradient(colors: [
case "apr_lvl1": // Color(0xFFCEEDFF),
SvgIcon = SvgPicture.asset("assets/svg/fin_lv1.svg"); // AppColors.scaffold_bg_color
break; // ],begin: Alignment.topCenter,end: Alignment.bottomCenter)
case "apr_lvl2": // ),
SvgIcon = SvgPicture.asset("assets/svg/fin_lv2.svg"); //
break; // ),
// final icons = ["comm_ic_1", "comm_ic_2"]; Container(
case "self_apr_lvl2": padding: EdgeInsets.symmetric(horizontal: 10),
SvgIcon = SvgPicture.asset("assets/svg/fin_lv2.svg"); child: Column(
break; crossAxisAlignment: CrossAxisAlignment.start,
default: children: [
SvgIcon = SvgPicture.asset("assets/svg/fin_ic.svg"); // if (filteredApprovalLevels.isNotEmpty) ...[
break; // Padding(
} // padding: const EdgeInsets.only(top: 10, bottom: 5),
return InkResponse( // child: Text(
onTap: () async { // "Approval Levels",
var navigate; // style: TextStyle(
if (pages[index].pageName == "Payments List") { // color: AppColors.grey_thick,
navigate = Paymentlistpaymentrequisition( // fontSize: 14,
pageTitleName: // fontFamily: "JakartaMedium",
provider.accessiblePagesList[index].pageName!, // ),
); // ),
} else if (provider // ),
.accessiblePagesList[index] // Container(
.pageName == // padding: EdgeInsets.symmetric(
"Payment Receipts List") { // vertical: 10,
navigate = Paymentreceiptlist( // horizontal: 15,
pageTitleName: // ),
provider.accessiblePagesList[index].pageName!, // decoration: BoxDecoration(
); // color: Colors.white,
} else if (provider // borderRadius: BorderRadius.circular(14),
.accessiblePagesList[index] // ),
.pageName == // child: Row(
"Account List") { // mainAxisAlignment: MainAxisAlignment.center,
navigate = Accountslist(); // 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; // break;
} else if (provider } else if (provider
.accessiblePagesList[index] .accessiblePagesList[index]
.pageName == .pageName ==
"Account Ledger") { "Account Ledger") {
navigate = Accountledger(); navigate = Accountledger();
} else { } else {
navigate = Allpaymentrequesitionlistsbymodes( navigate = Allpaymentrequesitionlistsbymodes(
mode: pages[index].mode!, mode: pages[index].mode!,
pageTitleName: pageTitleName:
provider.accessiblePagesList[index].pageName!, provider.accessiblePagesList[index].pageName!,
); );
} }
await Navigator.push( await Navigator.push(
context, context,
MaterialPageRoute(builder: (context) => navigate), MaterialPageRoute(builder: (context) => navigate),
); );
}, },
child: Container( child: Container(
margin: EdgeInsets.symmetric( margin: EdgeInsets.symmetric(
horizontal: 5, horizontal: 5,
vertical: 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,
),
), ),
] else if (provider padding: EdgeInsets.symmetric(
.accessiblePagesList[index] horizontal: 10,
.pageName == vertical: 15,
"Account Ledger") ...[
Expanded(
flex: 1,
child: SvgPicture.asset(
"assets/svg/comm_ic_2.svg",
width: 25,
),
), ),
] else ...[ decoration: BoxDecoration(
Expanded(flex: 1, child: SvgIcon), color: Colors.white,
], borderRadius: BorderRadius.circular(14),
Expanded( ),
flex: 5, child: Row(
child: Text("${pages[index].pageName}"), children: [
), if (provider
Expanded( .accessiblePagesList[index]
flex: 1, .pageName ==
child: SvgPicture.asset( "Account List") ...[
"assets/svg/arrow_right_new.svg", 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'; ...@@ -11,20 +11,23 @@ import 'package:qr_code_scanner/qr_code_scanner.dart';
import '../../Notifiers/HomeScreenNotifier.dart'; import '../../Notifiers/HomeScreenNotifier.dart';
import '../../Utils/app_colors.dart'; import '../../Utils/app_colors.dart';
import '../../Utils/commonWidgets.dart'; import '../../Utils/commonWidgets.dart';
class Scanentergeneratoridscreen extends StatefulWidget { class Scanentergeneratoridscreen extends StatefulWidget {
final from; final from;
const Scanentergeneratoridscreen({super.key,required this.from});
const Scanentergeneratoridscreen({super.key, required this.from});
@override @override
State<Scanentergeneratoridscreen> createState() => _ScanentergeneratoridscreenState(); State<Scanentergeneratoridscreen> createState() =>
_ScanentergeneratoridscreenState();
} }
class _ScanentergeneratoridscreenState extends State<Scanentergeneratoridscreen> { class _ScanentergeneratoridscreenState
extends State<Scanentergeneratoridscreen> {
FocusNode genIDFocusNode = FocusNode(); FocusNode genIDFocusNode = FocusNode();
TextEditingController genIDcontroller = TextEditingController(); TextEditingController genIDcontroller = TextEditingController();
Map _source = {ConnectivityResult.mobile: true}; Map _source = {ConnectivityResult.mobile: true};
final MyConnectivity _connectivity = MyConnectivity.instance; final MyConnectivity _connectivity = MyConnectivity.instance;
...@@ -44,11 +47,8 @@ class _ScanentergeneratoridscreenState extends State<Scanentergeneratoridscreen> ...@@ -44,11 +47,8 @@ class _ScanentergeneratoridscreenState extends State<Scanentergeneratoridscreen>
provider.initialFunction(widget.from); provider.initialFunction(widget.from);
provider.checkPermission1(); provider.checkPermission1();
provider.requestCameraPermission(); provider.requestCameraPermission();
if(widget.from=="Tag Location"){ provider.checkLocationPermission1();
provider.checkLocationPermission1(); provider.getLocationPermission(context);
provider.getLocationPermission(context);
}
}); });
} }
...@@ -59,11 +59,8 @@ class _ScanentergeneratoridscreenState extends State<Scanentergeneratoridscreen> ...@@ -59,11 +59,8 @@ class _ScanentergeneratoridscreenState extends State<Scanentergeneratoridscreen>
genIDcontroller.clear(); genIDcontroller.clear();
genIDcontroller.dispose(); genIDcontroller.dispose();
_connectivity.disposeStream(); _connectivity.disposeStream();
} }
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
switch (_source.keys.toList()[0]) { switch (_source.keys.toList()[0]) {
...@@ -77,84 +74,97 @@ class _ScanentergeneratoridscreenState extends State<Scanentergeneratoridscreen> ...@@ -77,84 +74,97 @@ class _ScanentergeneratoridscreenState extends State<Scanentergeneratoridscreen>
default: default:
connection = 'Offline'; connection = 'Offline';
} }
return connection=="Online"?Consumer<Generatordetailsprovider>( return connection == "Online"
builder: (context, provider, child) { ? Consumer<Generatordetailsprovider>(
return WillPopScope( builder: (context, provider, child) {
onWillPop: () => onBackPressed(context), return WillPopScope(
child: SafeArea( onWillPop: () => onBackPressed(context),
top: false, child: SafeArea(
bottom: Platform.isIOS?false:true, top: false,
child: Scaffold( bottom: Platform.isIOS ? false : true,
resizeToAvoidBottomInset: true, child: Scaffold(
backgroundColor: AppColors.scaffold_bg_color, resizeToAvoidBottomInset: true,
appBar: appbar(context, "${widget.from}"), backgroundColor: AppColors.scaffold_bg_color,
body: Container( appBar: appbar(context, "${widget.from}"),
decoration: BoxDecoration(color: Colors.black), body: Container(
child: Column( decoration: BoxDecoration(color: Colors.black),
children: [ child: Column(
Spacer(), children: [
SizedBox( Spacer(),
height: 250, SizedBox(
height: 250,
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, child: QRView(
borderRadius: 20, key: provider.scannerKey,
borderLength: 60, onQRViewCreated: (p0) {
borderWidth: 10, provider.onQRViewCreated(
cutOutSize: 250.0, 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(
SizedBox(height: 25), "Scan QR",
Text( textAlign: TextAlign.center,
"Scan QR", style: TextStyle(
textAlign: TextAlign.center, fontSize: 18,
style: TextStyle(fontSize: 18,fontFamily: "JakartaMedium", color: Colors.white), fontFamily: "JakartaMedium",
), color: Colors.white,
Text( ),
provider.subTitle, ),
textAlign: TextAlign.center, Text(
style: TextStyle(fontSize: 14, color: Colors.white), provider.subTitle,
), textAlign: TextAlign.center,
Spacer(), style: TextStyle(fontSize: 14, color: Colors.white),
Text( ),
"or", Spacer(),
textAlign: TextAlign.center, Text(
style: TextStyle(fontSize: 18, "or",
fontFamily: "JakartaMedium",color: Colors.white), textAlign: TextAlign.center,
), style: TextStyle(
InkResponse( fontSize: 18,
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", 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) { Future<void> _showgenIdBottomSheet(BuildContext context) {
...@@ -173,9 +183,9 @@ class _ScanentergeneratoridscreenState extends State<Scanentergeneratoridscreen> ...@@ -173,9 +183,9 @@ class _ScanentergeneratoridscreenState extends State<Scanentergeneratoridscreen>
child: Padding( child: Padding(
padding: EdgeInsets.only( padding: EdgeInsets.only(
bottom: bottom:
MediaQuery.of( MediaQuery.of(
context, context,
).viewInsets.bottom, // This handles keyboard ).viewInsets.bottom, // This handles keyboard
), ),
child: Container( child: Container(
margin: EdgeInsets.only( margin: EdgeInsets.only(
...@@ -185,14 +195,20 @@ class _ScanentergeneratoridscreenState extends State<Scanentergeneratoridscreen> ...@@ -185,14 +195,20 @@ class _ScanentergeneratoridscreenState extends State<Scanentergeneratoridscreen>
top: 30, top: 30,
), ),
child: Consumer2<Generatordetailsprovider, HomescreenNotifier>( child: Consumer2<
Generatordetailsprovider,
HomescreenNotifier
>(
builder: (context, provider, homeProvider, child) { builder: (context, provider, homeProvider, child) {
return SingleChildScrollView( return SingleChildScrollView(
child: Column( child: Column(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: [ children: [
Container( Container(
padding: EdgeInsets.symmetric(horizontal: 10,vertical: 5), padding: EdgeInsets.symmetric(
horizontal: 10,
vertical: 5,
),
alignment: Alignment.topLeft, alignment: Alignment.topLeft,
child: Text( child: Text(
"Gen ID", "Gen ID",
...@@ -210,12 +226,12 @@ class _ScanentergeneratoridscreenState extends State<Scanentergeneratoridscreen> ...@@ -210,12 +226,12 @@ class _ScanentergeneratoridscreenState extends State<Scanentergeneratoridscreen>
color: AppColors.text_field_color, color: AppColors.text_field_color,
borderRadius: BorderRadius.circular(14), borderRadius: BorderRadius.circular(14),
border: border:
genIDFocusNode.hasFocus genIDFocusNode.hasFocus
? Border.all( ? Border.all(
color: AppColors.app_blue, color: AppColors.app_blue,
width: 0.5, width: 0.5,
) )
: null, : null,
), ),
// alignment: Alignment.center, // alignment: Alignment.center,
margin: EdgeInsets.only(left: 5.0, right: 5.0), margin: EdgeInsets.only(left: 5.0, right: 5.0),
...@@ -230,7 +246,8 @@ class _ScanentergeneratoridscreenState extends State<Scanentergeneratoridscreen> ...@@ -230,7 +246,8 @@ class _ScanentergeneratoridscreenState extends State<Scanentergeneratoridscreen>
controller: genIDcontroller, controller: genIDcontroller,
keyboardType: TextInputType.text, keyboardType: TextInputType.text,
textCapitalization: TextCapitalization.characters, textCapitalization:
TextCapitalization.characters,
focusNode: genIDFocusNode, focusNode: genIDFocusNode,
style: TextStyle(fontSize: 14), style: TextStyle(fontSize: 14),
onChanged: (value) {}, onChanged: (value) {},
...@@ -252,52 +269,57 @@ class _ScanentergeneratoridscreenState extends State<Scanentergeneratoridscreen> ...@@ -252,52 +269,57 @@ class _ScanentergeneratoridscreenState extends State<Scanentergeneratoridscreen>
), ),
), ),
), ),
SizedBox(height: 15,), SizedBox(height: 15),
InkWell( 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){ break;
case "Generator Details": default:
provider.submitLoading = true; break;
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;
}
},
child: Container( child: Container(
alignment: Alignment.center, alignment: Alignment.center,
height: 45, height: 45,
...@@ -312,17 +334,23 @@ class _ScanentergeneratoridscreenState extends State<Scanentergeneratoridscreen> ...@@ -312,17 +334,23 @@ class _ScanentergeneratoridscreenState extends State<Scanentergeneratoridscreen>
borderRadius: BorderRadius.circular(15.0), borderRadius: BorderRadius.circular(15.0),
), ),
child: Center( child: Center(
child:provider.submitLoading?CircularProgressIndicator.adaptive( child:
valueColor: AlwaysStoppedAnimation(AppColors.white), provider.submitLoading
padding: EdgeInsets.all(10), ? CircularProgressIndicator.adaptive(
): Text( valueColor: AlwaysStoppedAnimation(
"Search", AppColors.white,
textAlign: TextAlign.center, ),
style: TextStyle(color: Colors.white, padding: EdgeInsets.all(10),
fontFamily: "JakartaMedium", )
fontSize: 16 : Text(
), "Search",
), textAlign: TextAlign.center,
style: TextStyle(
color: Colors.white,
fontFamily: "JakartaMedium",
fontSize: 16,
),
),
), ),
), ),
), ),
...@@ -343,8 +371,6 @@ class _ScanentergeneratoridscreenState extends State<Scanentergeneratoridscreen> ...@@ -343,8 +371,6 @@ class _ScanentergeneratoridscreenState extends State<Scanentergeneratoridscreen>
listen: false, listen: false,
); );
provider.qrViewController!.resumeCamera(); provider.qrViewController!.resumeCamera();
},); });
} }
} }
...@@ -22,7 +22,6 @@ class _ServiceengineerdashboardState extends State<Serviceengineerdashboard> { ...@@ -22,7 +22,6 @@ class _ServiceengineerdashboardState extends State<Serviceengineerdashboard> {
Map _source = {ConnectivityResult.mobile: true}; Map _source = {ConnectivityResult.mobile: true};
final MyConnectivity _connectivity = MyConnectivity.instance; final MyConnectivity _connectivity = MyConnectivity.instance;
@override @override
void initState() { void initState() {
super.initState(); super.initState();
...@@ -38,6 +37,7 @@ class _ServiceengineerdashboardState extends State<Serviceengineerdashboard> { ...@@ -38,6 +37,7 @@ class _ServiceengineerdashboardState extends State<Serviceengineerdashboard> {
serviceProvider.LoadTechnicianDashboard(context); serviceProvider.LoadTechnicianDashboard(context);
}); });
} }
@override @override
void dispose() { void dispose() {
// TODO: implement dispose // TODO: implement dispose
...@@ -58,12 +58,18 @@ class _ServiceengineerdashboardState extends State<Serviceengineerdashboard> { ...@@ -58,12 +58,18 @@ class _ServiceengineerdashboardState extends State<Serviceengineerdashboard> {
default: default:
connection = 'Offline'; connection = 'Offline';
} }
return (connection=="Online")? Platform.isAndroid return (connection == "Online")
? WillPopScope( ? Platform.isAndroid
onWillPop: () => onBackPressed(context), ? WillPopScope(
child: SafeArea(top: false, bottom: true, child: _scaffold(context)), onWillPop: () => onBackPressed(context),
) child: SafeArea(
: _scaffold(context):NoNetwork(context); top: false,
bottom: true,
child: _scaffold(context),
),
)
: _scaffold(context)
: NoNetwork(context);
} }
Widget _scaffold(BuildContext context) { Widget _scaffold(BuildContext context) {
...@@ -73,8 +79,8 @@ class _ServiceengineerdashboardState extends State<Serviceengineerdashboard> { ...@@ -73,8 +79,8 @@ class _ServiceengineerdashboardState extends State<Serviceengineerdashboard> {
resizeToAvoidBottomInset: true, resizeToAvoidBottomInset: true,
backgroundColor: AppColors.scaffold_bg_color, backgroundColor: AppColors.scaffold_bg_color,
appBar: AppBar( appBar: AppBar(
elevation: 2,
automaticallyImplyLeading: false, automaticallyImplyLeading: false,
elevation: 2.0,
title: SizedBox( title: SizedBox(
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
...@@ -83,10 +89,11 @@ class _ServiceengineerdashboardState extends State<Serviceengineerdashboard> { ...@@ -83,10 +89,11 @@ class _ServiceengineerdashboardState extends State<Serviceengineerdashboard> {
InkResponse( InkResponse(
onTap: () => Navigator.pop(context, true), onTap: () => Navigator.pop(context, true),
child: SvgPicture.asset( child: SvgPicture.asset(
"assets/svg/app_bar_back.svg", "assets/svg/appbar_back_button.svg",
height: 25, height: 25,
), ),
), ),
SizedBox(width: 10),
InkResponse( InkResponse(
onTap: () => Navigator.pop(context, true), onTap: () => Navigator.pop(context, true),
child: Text( child: Text(
...@@ -104,7 +111,7 @@ class _ServiceengineerdashboardState extends State<Serviceengineerdashboard> { ...@@ -104,7 +111,7 @@ class _ServiceengineerdashboardState extends State<Serviceengineerdashboard> {
height: 25, height: 25,
width: 45, width: 45,
decoration: BoxDecoration( decoration: BoxDecoration(
color: Color(0xFFFFF6E2), color: Color(0xFFEDF8FF),
borderRadius: BorderRadius.circular(20), borderRadius: BorderRadius.circular(20),
), ),
child: Row( child: Row(
...@@ -131,234 +138,301 @@ class _ServiceengineerdashboardState extends State<Serviceengineerdashboard> { ...@@ -131,234 +138,301 @@ class _ServiceengineerdashboardState extends State<Serviceengineerdashboard> {
), ),
), ),
), ),
body: Container( body: SingleChildScrollView(
child: SingleChildScrollView( child: Column(
child: Column( crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Container( Container(
margin: EdgeInsets.only(top: 0, bottom: 15), decoration: BoxDecoration(
decoration: BoxDecoration( color: Colors.white,
color: Colors.white, // borderRadius: BorderRadius.vertical(
borderRadius: BorderRadius.vertical( // bottom: Radius.circular(20),
bottom: Radius.circular(16), // ),
), borderRadius: BorderRadius.circular(20)
), ),
child: Column( child: Column(
children: [ // crossAxisAlignment: CrossAxisAlignment.start,
InkResponse( children: [
onTap: () { // Container(
Navigator.push( // height: 200,
context, // decoration: BoxDecoration(
MaterialPageRoute( // image: DecorationImage(
builder: (context) => Pendingcomplaints(), // 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,
), ),
); decoration: BoxDecoration(
}, color: Color(colorCodes[index]),
child: Container( borderRadius: BorderRadius.circular(20),
padding: EdgeInsets.symmetric( ),
horizontal: 10, child: Column(
vertical: 15, crossAxisAlignment: CrossAxisAlignment.start,
), mainAxisAlignment: MainAxisAlignment.center,
margin: EdgeInsets.symmetric( children: [
horizontal: 10, Row(
vertical: 15, children: [
), if ([0, 1].contains(index)) ...[
decoration: BoxDecoration(
color: Color(0xFFFFEFEF),
borderRadius: BorderRadius.circular(16),
),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Expanded(
child: SizedBox(
child: Column(
crossAxisAlignment:
CrossAxisAlignment.center,
children: [
Text( Text(
"${provider.pendingComplaints}", "",
style: TextStyle( style: TextStyle(
fontSize: 30, fontSize: 14,
color: Color(0xFFED3424), 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( decoration: BoxDecoration(
color: Colors.white, color: Colors.white,
borderRadius: BorderRadius.circular(16), borderRadius: BorderRadius.circular(20),
), ),
padding: EdgeInsets.symmetric(horizontal: 10, vertical: 15),
child: GridView.builder( child: SizedBox(
padding: EdgeInsets.symmetric( child: Row(
vertical: 15, crossAxisAlignment: CrossAxisAlignment.center,
horizontal: 10, children: [
), Expanded(
itemCount: 4, flex: 1,
shrinkWrap: true, child: Container(
physics: NeverScrollableScrollPhysics(), height: 50,
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( width: 50,
crossAxisCount: 2, decoration: BoxDecoration(
crossAxisSpacing: 10, color: Color(0xFFFFE4E2),
mainAxisSpacing: 10, shape: BoxShape.circle,
childAspectRatio: 22 / 10, ),
), child: Center(
itemBuilder: (context, index) { child: Text(
final numbers = [ "${provider.pendingComplaints}",
provider.monthlyPaymentCollectionAmount, textAlign: TextAlign.center,
provider.paymentCollectionWalletBalanceAmount, style: TextStyle(
provider.thisMonthsVisits, fontSize: 14,
provider.todayVisits, color: Color(0xFFED3424),
]; ),
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)),
), ),
], ),
), ),
), ),
); SizedBox(width: 10),
}, Expanded(
flex: 5,
child: Text(
"Pending Complaints",
style: TextStyle(
fontSize: 14,
color: AppColors.app_blue,
),
),
),
],
),
), ),
), ),
InkResponse( ),
onTap: () { Padding(
Navigator.push( padding: EdgeInsets.only(top: 10, bottom: 5, left: 10),
context, child: Text(
MaterialPageRoute( "Nearby Generators",
builder: (context) => Nearbygenerators(), style: TextStyle(color: AppColors.grey_thick, fontSize: 14),
), ),
); ),
}, InkResponse(
child: Container( onTap: () {
height: 60, Navigator.push(
margin: EdgeInsets.symmetric(horizontal: 10, vertical: 0), context,
decoration: BoxDecoration( MaterialPageRoute(
color: Colors.white, builder: (context) => Nearbygenerators(),
borderRadius: BorderRadius.circular(20),
), ),
);
},
child: Container(
height: 60,
margin: EdgeInsets.symmetric(horizontal: 10, vertical: 0),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(20),
),
child: Row( child: Row(
children: [ children: [
Expanded( Expanded(
flex: 1, flex: 1,
child: Container(
height: 35,
width: 35,
padding: EdgeInsets.all(8.0),
decoration: BoxDecoration(
color: Color(0xFFEDF8FF),
shape: BoxShape.circle,
),
child: SvgPicture.asset( child: SvgPicture.asset(
"assets/svg/find_generator.svg", "assets/svg/find_generator.svg",
), ),
), ),
Expanded( ),
flex: 4, Expanded(
child: Text("Find Nearby Generators"), 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 { ...@@ -571,6 +571,7 @@ class ApiCalling {
'gen_hash_id': (gen_hash_id).toString(), 'gen_hash_id': (gen_hash_id).toString(),
'location': (location).toString(), 'location': (location).toString(),
}; };
print("Tag Loation: ${data}");
var res; var res;
if (attachment != null) { if (attachment != null) {
res = await postImageNew( res = await postImageNew(
...@@ -625,6 +626,31 @@ class ApiCalling { ...@@ -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( static Future<SubmitComplaintResponse?> SubmitGeneratorComplaintAPI(
empId, empId,
session, session,
......
...@@ -25,6 +25,7 @@ const genTrackerGeneratorDetailsUrl = "${baseUrl}home/gen_tracker_generator_deta ...@@ -25,6 +25,7 @@ const genTrackerGeneratorDetailsUrl = "${baseUrl}home/gen_tracker_generator_deta
const genTrackerGeneratorComplaintsUrl = "${baseUrl}home/gen_tracker_generator_complaints_list"; const genTrackerGeneratorComplaintsUrl = "${baseUrl}home/gen_tracker_generator_complaints_list";
const genTrackerTagLocationUrl = "${baseUrl}home/gen_tracker_tag_location"; const genTrackerTagLocationUrl = "${baseUrl}home/gen_tracker_tag_location";
const genTrackerTagGeneratorUrl = "${baseUrl}home/gen_tracker_tag_generator"; 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"; const genTrackerRegisterComplaint = "${baseUrl}home/gen_tracker_register_complaint";
///complaint ///complaint
......
...@@ -45,10 +45,10 @@ packages: ...@@ -45,10 +45,10 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: async name: async
sha256: "758e6d74e971c3e5aceb4110bfd6698efc7f501675bcfe0c775459a8140750eb" sha256: d2872f9c19731c2e5f10444b14686eb7cc85c76274bd6c16e1816bff9a3bab63
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "2.13.0" version: "2.12.0"
auto_size_text: auto_size_text:
dependency: "direct main" dependency: "direct main"
description: description:
...@@ -273,6 +273,14 @@ packages: ...@@ -273,6 +273,14 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "2.1.1" 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: dropdown_button2:
dependency: "direct main" dependency: "direct main"
description: description:
...@@ -301,10 +309,10 @@ packages: ...@@ -301,10 +309,10 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: fake_async name: fake_async
sha256: "5368f224a74523e8d2e7399ea1638b37aecfca824a3cc4dfdf77bf1fa905ac44" sha256: "6a95e56b2449df2273fd8c45a662d6947ce1ebb7aafe80e550a3f68297f3cacc"
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "1.3.3" version: "1.3.2"
ffi: ffi:
dependency: transitive dependency: transitive
description: description:
...@@ -662,6 +670,14 @@ packages: ...@@ -662,6 +670,14 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "4.0.0+4" 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: flutter_svg:
dependency: "direct main" dependency: "direct main"
description: description:
...@@ -948,26 +964,26 @@ packages: ...@@ -948,26 +964,26 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: leak_tracker name: leak_tracker
sha256: "8dcda04c3fc16c14f48a7bb586d4be1f0d1572731b6d81d51772ef47c02081e0" sha256: c35baad643ba394b40aac41080300150a4f08fd0fd6a10378f8f7c6bc161acec
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "11.0.1" version: "10.0.8"
leak_tracker_flutter_testing: leak_tracker_flutter_testing:
dependency: transitive dependency: transitive
description: description:
name: leak_tracker_flutter_testing name: leak_tracker_flutter_testing
sha256: "1dbc140bb5a23c75ea9c4811222756104fbcd1a27173f0c34ca01e16bea473c1" sha256: f8b613e7e6a13ec79cfdc0e97638fddb3ab848452eff057653abd3edba760573
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "3.0.10" version: "3.0.9"
leak_tracker_testing: leak_tracker_testing:
dependency: transitive dependency: transitive
description: description:
name: leak_tracker_testing name: leak_tracker_testing
sha256: "8d5a2d49f4a66b49744b23b018848400d23e54caf9463f4eb20df3eb8acb2eb1" sha256: "6ba465d5d76e67ddf503e1161d1f4a6bc42306f9d66ca1e8f079a47290fb06d3"
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "3.0.2" version: "3.0.1"
lints: lints:
dependency: transitive dependency: transitive
description: description:
...@@ -1673,10 +1689,10 @@ packages: ...@@ -1673,10 +1689,10 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: vm_service name: vm_service
sha256: ddfa8d30d89985b96407efce8acbdd124701f96741f2d981ca860662f1c0dc02 sha256: "0968250880a6c5fe7edc067ed0a13d4bae1577fe2771dcf3010d52c4a9d3ca14"
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "15.0.0" version: "14.3.1"
web: web:
dependency: transitive dependency: transitive
description: description:
......
...@@ -16,7 +16,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev ...@@ -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 # 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 # 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. # 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: environment:
sdk: ^3.7.2 sdk: ^3.7.2
...@@ -82,6 +82,8 @@ dependencies: ...@@ -82,6 +82,8 @@ dependencies:
collection: ^1.19.1 collection: ^1.19.1
auto_size_text: ^3.0.0 auto_size_text: ^3.0.0
app_settings: ^6.1.1 app_settings: ^6.1.1
flutter_staggered_grid_view: ^0.7.0
dotted_line: ^3.2.3
dev_dependencies: dev_dependencies:
flutter_test: flutter_test:
...@@ -113,6 +115,11 @@ flutter: ...@@ -113,6 +115,11 @@ flutter:
- assets/ - assets/
- assets/images/ - assets/images/
- assets/svg/ - 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 # An image asset can refer to one or more resolution-specific "variants", see
# https://flutter.dev/to/resolution-aware-images # 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