FIX_BUG_Solved
This commit is contained in:
parent
50a1efb695
commit
ae1abb3243
File diff suppressed because one or more lines are too long
@ -40,7 +40,7 @@ class ToastHelper {
|
|||||||
showProgressBar: true,
|
showProgressBar: true,
|
||||||
closeButtonShowType: CloseButtonShowType.onHover,
|
closeButtonShowType: CloseButtonShowType.onHover,
|
||||||
closeOnClick: false,
|
closeOnClick: false,
|
||||||
pauseOnHover: true,
|
pauseOnHover: false,
|
||||||
dragToClose: true,
|
dragToClose: true,
|
||||||
applyBlurEffect: true,
|
applyBlurEffect: true,
|
||||||
callbacks: ToastificationCallbacks(
|
callbacks: ToastificationCallbacks(
|
||||||
@ -88,7 +88,7 @@ class ToastHelper {
|
|||||||
showProgressBar: true,
|
showProgressBar: true,
|
||||||
closeButtonShowType: CloseButtonShowType.onHover,
|
closeButtonShowType: CloseButtonShowType.onHover,
|
||||||
closeOnClick: false,
|
closeOnClick: false,
|
||||||
pauseOnHover: true,
|
pauseOnHover: false,
|
||||||
dragToClose: true,
|
dragToClose: true,
|
||||||
applyBlurEffect: true,
|
applyBlurEffect: true,
|
||||||
callbacks: ToastificationCallbacks(
|
callbacks: ToastificationCallbacks(
|
||||||
@ -136,7 +136,7 @@ class ToastHelper {
|
|||||||
showProgressBar: true,
|
showProgressBar: true,
|
||||||
closeButtonShowType: CloseButtonShowType.onHover,
|
closeButtonShowType: CloseButtonShowType.onHover,
|
||||||
closeOnClick: false,
|
closeOnClick: false,
|
||||||
pauseOnHover: true,
|
pauseOnHover: false,
|
||||||
dragToClose: true,
|
dragToClose: true,
|
||||||
applyBlurEffect: true,
|
applyBlurEffect: true,
|
||||||
callbacks: ToastificationCallbacks(
|
callbacks: ToastificationCallbacks(
|
||||||
@ -185,7 +185,7 @@ class ToastHelper {
|
|||||||
showProgressBar: true,
|
showProgressBar: true,
|
||||||
closeButtonShowType: CloseButtonShowType.onHover,
|
closeButtonShowType: CloseButtonShowType.onHover,
|
||||||
closeOnClick: false,
|
closeOnClick: false,
|
||||||
pauseOnHover: true,
|
pauseOnHover: false,
|
||||||
dragToClose: true,
|
dragToClose: true,
|
||||||
applyBlurEffect: true,
|
applyBlurEffect: true,
|
||||||
callbacks: ToastificationCallbacks(
|
callbacks: ToastificationCallbacks(
|
||||||
|
|||||||
@ -237,6 +237,10 @@ class _endorsomentValidationState extends ConsumerState<endorsomentValidation> {
|
|||||||
bool showExistingFile = false;
|
bool showExistingFile = false;
|
||||||
String? existingFileName;
|
String? existingFileName;
|
||||||
|
|
||||||
|
bool showEndorsementExistingFile = false;
|
||||||
|
String? existingEndorsementFileName;
|
||||||
|
PlatformFile? docUploadedEndorsementEndorsFile;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
@ -248,6 +252,9 @@ class _endorsomentValidationState extends ConsumerState<endorsomentValidation> {
|
|||||||
showExistingFile =
|
showExistingFile =
|
||||||
existingFileName != null && existingFileName.toString().isNotEmpty;
|
existingFileName != null && existingFileName.toString().isNotEmpty;
|
||||||
|
|
||||||
|
existingEndorsementFileName = widget.item?['endorsement_completion_file'];
|
||||||
|
showEndorsementExistingFile = existingEndorsementFileName != null && existingEndorsementFileName.toString().isNotEmpty;
|
||||||
|
|
||||||
// ✅ INITIALIZE CONTROLLERS MAP
|
// ✅ INITIALIZE CONTROLLERS MAP
|
||||||
controllers = {
|
controllers = {
|
||||||
'policyNum': TextEditingController(),
|
'policyNum': TextEditingController(),
|
||||||
@ -664,6 +671,22 @@ class _endorsomentValidationState extends ConsumerState<endorsomentValidation> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (docUploadedEndorsementEndorsFile != null) {
|
||||||
|
try {
|
||||||
|
if (docUploadedEndorsementEndorsFile!.bytes != null) {
|
||||||
|
final multipartFile = http.MultipartFile.fromBytes(
|
||||||
|
'endorsement_completion_file', // ✅ Endorsement file field key
|
||||||
|
docUploadedEndorsementEndorsFile!.bytes!,
|
||||||
|
filename: docUploadedEndorsementEndorsFile!.name,
|
||||||
|
);
|
||||||
|
request.files.add(multipartFile);
|
||||||
|
}
|
||||||
|
print("📎 Endorsement file attached: ${docUploadedEndorsementEndorsFile!.name}");
|
||||||
|
} catch (e) {
|
||||||
|
print("❌ Failed to attach Endorsement file: $e");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
print(" Sending request with fields: ${request.fields}");
|
print(" Sending request with fields: ${request.fields}");
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -702,6 +725,16 @@ class _endorsomentValidationState extends ConsumerState<endorsomentValidation> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String get pdfDocumentTitle {
|
||||||
|
if (existingEndorsementFileName != null && existingEndorsementFileName!.isNotEmpty) {
|
||||||
|
return 'Endorsement Document';
|
||||||
|
} else if (existingFileName != null && existingFileName!.isNotEmpty) {
|
||||||
|
return 'Policy Document';
|
||||||
|
} else {
|
||||||
|
return 'Document';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// ================= UI =================
|
// ================= UI =================
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -781,9 +814,9 @@ class _endorsomentValidationState extends ConsumerState<endorsomentValidation> {
|
|||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||||
children: [
|
children: [
|
||||||
const Text(
|
Text(
|
||||||
'Original Endorsement Document',
|
pdfDocumentTitle,
|
||||||
style: TextStyle(
|
style: const TextStyle(
|
||||||
fontSize: 13,
|
fontSize: 13,
|
||||||
fontWeight: FontWeight.w500,
|
fontWeight: FontWeight.w500,
|
||||||
),
|
),
|
||||||
@ -1280,6 +1313,16 @@ class _endorsomentValidationState extends ConsumerState<endorsomentValidation> {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|
||||||
|
Row(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Expanded(child: buildEndorsementUploadBox()),
|
||||||
|
const SizedBox(width: 25),
|
||||||
|
const Expanded(child: SizedBox()), // ✅ empty spacer
|
||||||
|
],
|
||||||
|
),
|
||||||
|
|
||||||
|
|
||||||
Divider(
|
Divider(
|
||||||
color: Color(0xFFe5e7eb),
|
color: Color(0xFFe5e7eb),
|
||||||
thickness: 1,
|
thickness: 1,
|
||||||
@ -1721,7 +1764,7 @@ class _endorsomentValidationState extends ConsumerState<endorsomentValidation> {
|
|||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
children: const [
|
children: const [
|
||||||
Text(
|
Text(
|
||||||
"Upload Document",
|
"Upload Policy Document",
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 12,
|
fontSize: 12,
|
||||||
fontWeight: FontWeight.w500,
|
fontWeight: FontWeight.w500,
|
||||||
@ -1749,22 +1792,36 @@ class _endorsomentValidationState extends ConsumerState<endorsomentValidation> {
|
|||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
const Icon(Icons.insert_drive_file, color: Color(0xFF0F766E)),
|
const Icon(Icons.insert_drive_file, color: Color(0xFF0F766E)),
|
||||||
|
|
||||||
const SizedBox(width: 12),
|
const SizedBox(width: 12),
|
||||||
|
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Text(
|
child: Text(
|
||||||
existingFileName!,
|
existingFileName!,
|
||||||
overflow: TextOverflow.ellipsis,
|
overflow: TextOverflow.ellipsis,
|
||||||
style: const TextStyle(
|
style: const TextStyle(fontSize: 13, fontWeight: FontWeight.w400),
|
||||||
fontSize: 13,
|
|
||||||
fontWeight: FontWeight.w400,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
||||||
|
/// ⬇️ DOWNLOAD BUTTON
|
||||||
|
Tooltip(
|
||||||
|
message: "Download",
|
||||||
|
child: GestureDetector(
|
||||||
|
onTap: () {
|
||||||
|
final id = widget.item?['id'];
|
||||||
|
apiService.downloadFile(
|
||||||
|
apiUrl: 'endorsement/downloadEndorsementCompletionFile?id=$id',
|
||||||
|
apiId: id,
|
||||||
|
localFile: null,
|
||||||
|
fileName: existingFileName!,
|
||||||
|
);
|
||||||
|
},
|
||||||
|
child: const Icon(Icons.download, color: Color(0xFF0F766E)),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(width: 8),
|
||||||
/// ❌ REMOVE BUTTON
|
/// ❌ REMOVE BUTTON
|
||||||
GestureDetector(
|
Tooltip(
|
||||||
|
message: "Remove",
|
||||||
|
child: GestureDetector(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
setState(() {
|
setState(() {
|
||||||
showExistingFile = false;
|
showExistingFile = false;
|
||||||
@ -1774,6 +1831,7 @@ class _endorsomentValidationState extends ConsumerState<endorsomentValidation> {
|
|||||||
},
|
},
|
||||||
child: const Icon(Icons.close, color: Colors.red),
|
child: const Icon(Icons.close, color: Colors.red),
|
||||||
),
|
),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
@ -1845,6 +1903,145 @@ class _endorsomentValidationState extends ConsumerState<endorsomentValidation> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Widget buildEndorsementUploadBox() {
|
||||||
|
return Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
/// Label Row
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: const [
|
||||||
|
Text(
|
||||||
|
"Upload Endorsement Document",
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 12,
|
||||||
|
fontWeight: FontWeight.w500,
|
||||||
|
color: Color(0xFF374151),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Text("PDF",style: TextStyle(fontSize: 10, color: Color(0xFF6B7280)),),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
const SizedBox(height: 10),
|
||||||
|
|
||||||
|
/// 🔹 IF Endorsement EXISTING FILE (EDIT MODE)
|
||||||
|
if (showEndorsementExistingFile && existingEndorsementFileName != null)
|
||||||
|
Container(
|
||||||
|
height: 70,
|
||||||
|
padding: const EdgeInsets.symmetric(horizontal: 14),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: const Color(0xFFF8FAFC),
|
||||||
|
borderRadius: BorderRadius.circular(14),
|
||||||
|
border: Border.all(color: const Color(0xFF0F766E), width: 1.5),
|
||||||
|
),
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
const Icon(Icons.insert_drive_file, color: Color(0xFF0F766E)),
|
||||||
|
const SizedBox(width: 12),
|
||||||
|
Expanded(
|
||||||
|
child: Text(
|
||||||
|
existingEndorsementFileName!,
|
||||||
|
overflow: TextOverflow.ellipsis,
|
||||||
|
style: const TextStyle(fontSize: 13, fontWeight: FontWeight.w400),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
|
||||||
|
/// ⬇️ DOWNLOAD BUTTON
|
||||||
|
Tooltip(
|
||||||
|
message: "Download",
|
||||||
|
child: GestureDetector(
|
||||||
|
onTap: () {
|
||||||
|
final id = widget.item?['id'];
|
||||||
|
apiService.downloadFile(
|
||||||
|
apiUrl: 'endorsement/downloadEndorsementCompletionFile?id=$id&type=completion',
|
||||||
|
apiId: id,
|
||||||
|
localFile: null,
|
||||||
|
fileName: existingEndorsementFileName!,
|
||||||
|
);
|
||||||
|
},
|
||||||
|
child: const Icon(Icons.download, color: Color(0xFF0F766E)),
|
||||||
|
),),
|
||||||
|
const SizedBox(width: 8),
|
||||||
|
/// ❌ REMOVE Endorsement BUTTON
|
||||||
|
Tooltip(
|
||||||
|
message: "Remove",
|
||||||
|
child: GestureDetector(
|
||||||
|
onTap: () {
|
||||||
|
setState(() {
|
||||||
|
showEndorsementExistingFile = false;
|
||||||
|
existingEndorsementFileName = null;
|
||||||
|
docUploadedEndorsementEndorsFile = null;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
child: const Icon(Icons.close, color: Colors.red),
|
||||||
|
),),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
)
|
||||||
|
/// 🔹 ELSE SHOW Endorsement UPLOAD BOX
|
||||||
|
else
|
||||||
|
GestureDetector(
|
||||||
|
onTap: () async {
|
||||||
|
FilePickerResult? result = await FilePicker.platform.pickFiles(
|
||||||
|
type: FileType.custom,
|
||||||
|
allowedExtensions: ['pdf'],
|
||||||
|
);
|
||||||
|
|
||||||
|
if (result != null) {
|
||||||
|
setState(() {
|
||||||
|
docUploadedEndorsementEndorsFile = result.files.first;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
child: Container(
|
||||||
|
height: 160,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: const Color(0xFFF8FAFC),
|
||||||
|
borderRadius: BorderRadius.circular(14),
|
||||||
|
border: Border.all(color: const Color(0xFF0F766E), width: 1.5),
|
||||||
|
),
|
||||||
|
child: Column(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
const Icon(
|
||||||
|
Icons.attach_file,
|
||||||
|
size: 34,
|
||||||
|
color: Color(0xFF9CA3AF),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 12),
|
||||||
|
Text(
|
||||||
|
docUploadedEndorsementEndorsFile != null
|
||||||
|
? docUploadedEndorsementEndorsFile!.name
|
||||||
|
: "Click to upload or drag & drop",
|
||||||
|
style: const TextStyle(
|
||||||
|
fontSize: 13,
|
||||||
|
fontWeight: FontWeight.w400,
|
||||||
|
color: Color(0xFF374151),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 6),
|
||||||
|
const Text(
|
||||||
|
"Endorsement document, endorsement copy",
|
||||||
|
style: TextStyle(fontSize: 11, color: Color(0xFF6B7280)),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 10),
|
||||||
|
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
buildFileChip("PDF"),
|
||||||
|
const SizedBox(width: 8),
|
||||||
|
buildFileChip("Max 5MB"),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
// Widget buildUploadBox() {
|
// Widget buildUploadBox() {
|
||||||
// return Column(
|
// return Column(
|
||||||
// crossAxisAlignment: CrossAxisAlignment.start,
|
// crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
|||||||
@ -2210,7 +2210,7 @@ class endosementState extends ConsumerState<Endorsement> {
|
|||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: [
|
children: [
|
||||||
Text('Upload Endorsement PDF', style: _dataBold),
|
Text('Upload Revised Endorsement Document (PDF)', style: _dataBold),
|
||||||
const SizedBox(height: 10),
|
const SizedBox(height: 10),
|
||||||
_buildEndorsementUploadField(item),
|
_buildEndorsementUploadField(item),
|
||||||
],
|
],
|
||||||
@ -2233,12 +2233,12 @@ class endosementState extends ConsumerState<Endorsement> {
|
|||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: [
|
children: [
|
||||||
// ── UPLOAD LABEL ──────────────────────────────
|
// ── UPLOAD LABEL ──────────────────────────────
|
||||||
Text('Upload', style: GoogleFonts.poppins(fontSize: 11, fontWeight: FontWeight.w500)),
|
Text('Upload Revised Document', style: GoogleFonts.poppins(fontSize: 11, fontWeight: FontWeight.w500)),
|
||||||
const SizedBox(height: 6),
|
const SizedBox(height: 6),
|
||||||
|
|
||||||
// ── UPLOAD FIELD ──────────────────────────────
|
// ── UPLOAD FIELD ──────────────────────────────
|
||||||
ThemedUploadField(
|
ThemedUploadField(
|
||||||
hintText: selectedFileNames ?? "Upload Document",
|
hintText: selectedFileNames ?? "Upload Revised Document",
|
||||||
padHorizontal: 4,
|
padHorizontal: 4,
|
||||||
padVertical: 5,
|
padVertical: 5,
|
||||||
fontSZ: 11,
|
fontSZ: 11,
|
||||||
|
|||||||
@ -1212,7 +1212,6 @@ class othersPendings extends StatelessWidget {
|
|||||||
final List<Map<String, dynamic>> data;
|
final List<Map<String, dynamic>> data;
|
||||||
final VoidCallback? onRefresh;
|
final VoidCallback? onRefresh;
|
||||||
VoidCallback? onExportExcel;
|
VoidCallback? onExportExcel;
|
||||||
// final Future<void> Function(String status, String staffId)? onCallExport;
|
|
||||||
|
|
||||||
othersPendings({
|
othersPendings({
|
||||||
Key? key,
|
Key? key,
|
||||||
@ -1222,50 +1221,31 @@ class othersPendings extends StatelessWidget {
|
|||||||
required this.stringFlag,
|
required this.stringFlag,
|
||||||
required this.onRefresh,
|
required this.onRefresh,
|
||||||
this.onExportExcel,
|
this.onExportExcel,
|
||||||
// this.onCallExport,
|
|
||||||
}) : super(key: key);
|
}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
print(' Data: $data');
|
// ── Compute totals ──────────────────────────────────────
|
||||||
|
|
||||||
// Compute totals
|
|
||||||
int totalTodayAssigned = 0;
|
int totalTodayAssigned = 0;
|
||||||
int totalPending = 0;
|
int totalPending = 0;
|
||||||
int totalInProgress = 0;
|
int totalInProgress = 0;
|
||||||
int totalCompleted = 0;
|
int totalCompleted = 0;
|
||||||
int totalPrevPending = 0;
|
int totalPrevPending = 0;
|
||||||
int totalPendingAll = 0;
|
|
||||||
|
|
||||||
for (var row in data) {
|
for (var row in data) {
|
||||||
totalTodayAssigned += int.tryParse(row['today_assigned'] ?? '0') ?? 0;
|
totalTodayAssigned += int.tryParse(row['today_assigned'] ?? '0') ?? 0;
|
||||||
totalPending += int.tryParse(row['today_pending'] ?? '0') ?? 0;
|
totalPending += int.tryParse(row['today_pending'] ?? '0') ?? 0;
|
||||||
totalInProgress += int.tryParse(row['today_in_progress'] ?? '0') ?? 0;
|
totalInProgress += int.tryParse(row['today_in_progress'] ?? '0') ?? 0;
|
||||||
totalCompleted += int.tryParse(row['today_completed'] ?? '0') ?? 0;
|
totalCompleted += int.tryParse(row['today_completed'] ?? '0') ?? 0;
|
||||||
totalPrevPending += int.tryParse(row['total_completed'] ?? '0') ?? 0;
|
|
||||||
|
|
||||||
int totalPendingdata =
|
|
||||||
int.tryParse(row['total_pending']?.toString() ?? '0') ?? 0;
|
|
||||||
int todayAssigned =
|
|
||||||
int.tryParse(row['today_assigned']?.toString() ?? '0') ?? 0;
|
|
||||||
|
|
||||||
// totalTodayAssigned += todayAssigned;
|
|
||||||
totalPendingAll += totalPendingdata;
|
|
||||||
|
|
||||||
int staffPending = totalPendingdata - todayAssigned;
|
|
||||||
|
|
||||||
// totalPrevPending += staffPending;
|
|
||||||
|
|
||||||
final rowPrevPending =
|
final rowPrevPending =
|
||||||
(int.tryParse(row['total_pending'] ?? '0') ?? 0) -
|
(int.tryParse(row['total_pending'] ?? '0') ?? 0) -
|
||||||
(int.tryParse(row['today_assigned'] ?? '0') ?? 0);
|
(int.tryParse(row['today_assigned'] ?? '0') ?? 0);
|
||||||
|
|
||||||
totalPrevPending += rowPrevPending < 0 ? 0 : rowPrevPending;
|
totalPrevPending += rowPrevPending < 0 ? 0 : rowPrevPending;
|
||||||
}
|
}
|
||||||
|
|
||||||
return Card(
|
return Card(
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
// color: const Color(0xFFEAF6F4),
|
|
||||||
elevation: 1,
|
elevation: 1,
|
||||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)),
|
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)),
|
||||||
child: Padding(
|
child: Padding(
|
||||||
@ -1273,17 +1253,15 @@ class othersPendings extends StatelessWidget {
|
|||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
// Title
|
|
||||||
|
// ── Title Row ───────────────────────────────────
|
||||||
Row(
|
Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
|
||||||
children: [
|
children: [
|
||||||
Text(title, style: _chartHeader),
|
Text(title, style: _chartHeader),
|
||||||
Spacer(),
|
const Spacer(),
|
||||||
InkWell(
|
InkWell(
|
||||||
onTap: () {
|
onTap: () => onRefresh?.call(),
|
||||||
onRefresh!();
|
child: const Icon(Icons.refresh, size: 18),
|
||||||
},
|
|
||||||
child: Icon(Icons.refresh, size: 18),
|
|
||||||
),
|
),
|
||||||
const SizedBox(width: 12),
|
const SizedBox(width: 12),
|
||||||
InkWell(
|
InkWell(
|
||||||
@ -1308,435 +1286,82 @@ class othersPendings extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
const SizedBox(height: 10),
|
const SizedBox(height: 10),
|
||||||
|
|
||||||
// Header row
|
// ── Header Row ──────────────────────────────────
|
||||||
Container(
|
Container(
|
||||||
padding: const EdgeInsets.symmetric(vertical: 8, horizontal: 12),
|
padding: const EdgeInsets.symmetric(vertical: 8, horizontal: 12),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: Color(0xFFE3F9F8),
|
color: const Color(0xFFE3F9F8),
|
||||||
// color: const Color(0xFF3E5B56),
|
|
||||||
borderRadius: BorderRadius.circular(10),
|
borderRadius: BorderRadius.circular(10),
|
||||||
),
|
),
|
||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
// Expanded(
|
Expanded(flex: 2, child: Text("Staff Name", textAlign: TextAlign.center, style: _headerStyle)),
|
||||||
// flex: 1,
|
Expanded(flex: 2, child: Text("Today Assigned", textAlign: TextAlign.center, style: _headerStyle)),
|
||||||
// child: Text(
|
Expanded(flex: 2, child: Text("Pending", textAlign: TextAlign.center, style: _headerStyle)),
|
||||||
// "S.No",
|
Expanded(flex: 2, child: Text("In Progress", textAlign: TextAlign.center, style: _headerStyle)),
|
||||||
// textAlign: TextAlign.center,
|
Expanded(flex: 2, child: Text("Completed", textAlign: TextAlign.center, style: _headerStyle)),
|
||||||
// style: _headerStyle,
|
Expanded(flex: 2, child: Text("Prev Pending", textAlign: TextAlign.center, style: _headerStyle)),
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// if (role == 'manager') ...[
|
|
||||||
// Expanded(
|
|
||||||
// flex: 2,
|
|
||||||
// child: Text(
|
|
||||||
// "Handler Name",
|
|
||||||
// textAlign: TextAlign.center,
|
|
||||||
// style: _headerStyle,
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// ],
|
|
||||||
Expanded(
|
|
||||||
flex: 2,
|
|
||||||
child: Text(
|
|
||||||
"Staff Name",
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
style: _headerStyle,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
|
|
||||||
// Expanded(
|
|
||||||
// flex: 2,
|
|
||||||
// child: Text(
|
|
||||||
// // stringFlag + " Issued",
|
|
||||||
// 'Total Assigned',
|
|
||||||
// textAlign: TextAlign.center,
|
|
||||||
// style: _headerStyle,
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// Expanded(
|
|
||||||
// flex: 2,
|
|
||||||
// child: Text(
|
|
||||||
// 'To be assigned',
|
|
||||||
// textAlign: TextAlign.center,
|
|
||||||
// style: _headerStyle,
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// Expanded(
|
|
||||||
// flex: 2,
|
|
||||||
// child: Text(
|
|
||||||
// 'Total Assigned',
|
|
||||||
// textAlign: TextAlign.center,
|
|
||||||
// style: _headerStyle,
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
Expanded(
|
|
||||||
flex: 2,
|
|
||||||
child: Text(
|
|
||||||
'Today Assigned',
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
style: _headerStyle,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
|
|
||||||
Expanded(
|
|
||||||
flex: 2,
|
|
||||||
child: Text(
|
|
||||||
'Pending',
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
style: _headerStyle,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Expanded(
|
|
||||||
flex: 2,
|
|
||||||
child: Text(
|
|
||||||
'In Progress',
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
style: _headerStyle,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Expanded(
|
|
||||||
flex: 2,
|
|
||||||
child: Text(
|
|
||||||
'Completed',
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
style: _headerStyle,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Expanded(
|
|
||||||
flex: 2,
|
|
||||||
child: Text(
|
|
||||||
'Prev Pending',
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
style: _headerStyle,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
// Expanded(
|
|
||||||
// flex: 2,
|
|
||||||
// child: Text(
|
|
||||||
// // stringFlag + " Issued",
|
|
||||||
// 'Policy Created',
|
|
||||||
// textAlign: TextAlign.center,
|
|
||||||
// style: _headerStyle,
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 8),
|
const SizedBox(height: 6),
|
||||||
|
|
||||||
// List of rows
|
// ── Data Rows ───────────────────────────────────
|
||||||
Flexible(
|
Flexible(
|
||||||
child: ListView.builder(
|
child: ListView.builder(
|
||||||
itemCount: data.length,
|
itemCount: data.length,
|
||||||
itemBuilder: (context, index) {
|
itemBuilder: (context, index) {
|
||||||
final row = data[index];
|
final row = data[index];
|
||||||
|
|
||||||
final totalPending =
|
final totalPendingVal =
|
||||||
int.tryParse(row['total_pending']?.toString() ?? '0') ??
|
int.tryParse(row['total_pending']?.toString() ?? '0') ?? 0;
|
||||||
0;
|
final todayAssignedVal =
|
||||||
final todayAssigned =
|
int.tryParse(row['today_assigned']?.toString() ?? '0') ?? 0;
|
||||||
int.tryParse(row['today_assigned']?.toString() ?? '0') ??
|
final safePending =
|
||||||
0;
|
(totalPendingVal - todayAssignedVal).clamp(0, 99999);
|
||||||
|
|
||||||
final staffPending = (totalPending - todayAssigned);
|
return _HoverableRow(
|
||||||
final safePending = staffPending < 0 ? 0 : staffPending;
|
onTap: () => handleDashboardNavigation(
|
||||||
|
context,
|
||||||
// final staffPending = totalPending - todayAssigned;
|
status: '',
|
||||||
|
staffId: row['staff_id'] ?? '',
|
||||||
final issuedCount = stringFlag == "Policies"
|
role: role,
|
||||||
? (row['total_policis_pending'] ?? 0).toString()
|
|
||||||
: (row['total_quotation_pending'] ?? 0).toString();
|
|
||||||
|
|
||||||
final permiumValue = row['total_premium_value'] == null
|
|
||||||
? '0'
|
|
||||||
: row['total_premium_value'];
|
|
||||||
|
|
||||||
return Container(
|
|
||||||
margin: const EdgeInsets.symmetric(vertical: 3),
|
|
||||||
padding: const EdgeInsets.symmetric(
|
|
||||||
vertical: 4,
|
|
||||||
horizontal: 12,
|
|
||||||
),
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: Colors.white,
|
|
||||||
border: Border(
|
|
||||||
bottom: BorderSide(
|
|
||||||
color: Colors.blueGrey.shade100,
|
|
||||||
width: 0.3,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
// borderRadius: BorderRadius.circular(10),
|
|
||||||
),
|
),
|
||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
Expanded(
|
_dataCell(row['staff_name'] ?? '', flex: 2),
|
||||||
flex: 2,
|
_dataCell(row['today_assigned'] ?? '', flex: 2),
|
||||||
child: Text(
|
_dataCell(row['today_pending'] ?? '', flex: 2),
|
||||||
row['staff_name'] ?? "",
|
_dataCell(row['today_in_progress'] ?? '', flex: 2),
|
||||||
textAlign: TextAlign.left,
|
_dataCell(row['today_completed'] ?? '', flex: 2),
|
||||||
// textAlign: TextAlign.center,
|
_dataCell(safePending.toString(), flex: 2),
|
||||||
style: _tableDataStyle,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
|
|
||||||
Expanded(
|
|
||||||
flex: 2,
|
|
||||||
child: Material(
|
|
||||||
color: Colors.white,
|
|
||||||
child: Center(
|
|
||||||
child: InkWell(
|
|
||||||
hoverColor: Color(0xFFEAF6F4),
|
|
||||||
onTap: () async {
|
|
||||||
print(
|
|
||||||
'total_assigned_today : ${row['total_assigned']}',
|
|
||||||
);
|
|
||||||
|
|
||||||
handleDashboardNavigation(
|
|
||||||
context,
|
|
||||||
status: '',
|
|
||||||
// status: "Assigned",
|
|
||||||
staffId: row['staff_id'] ?? '',
|
|
||||||
role: role,
|
|
||||||
);
|
|
||||||
// if (onCallExport != null) {
|
|
||||||
// await onCallExport!(
|
|
||||||
// "TodayAssigned",
|
|
||||||
// row['staff_id'].toString(),
|
|
||||||
// );
|
|
||||||
// }
|
|
||||||
},
|
|
||||||
child: Text(
|
|
||||||
row['today_assigned'] ?? "",
|
|
||||||
// row['total_approval_pending'] ?? "",
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
style: _tableDataStyle,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Expanded(
|
|
||||||
flex: 2,
|
|
||||||
child: Material(
|
|
||||||
color: Colors.white,
|
|
||||||
child: Center(
|
|
||||||
child: InkWell(
|
|
||||||
hoverColor: Color(0xFFEAF6F4),
|
|
||||||
onTap: () async {
|
|
||||||
print(
|
|
||||||
'total_assigned : ${row['total_assigned']}',
|
|
||||||
);
|
|
||||||
|
|
||||||
handleDashboardNavigation(
|
|
||||||
context,
|
|
||||||
status: "Assigned",
|
|
||||||
staffId: row['staff_id'] ?? '',
|
|
||||||
role: role,
|
|
||||||
);
|
|
||||||
// if (onCallExport != null) {
|
|
||||||
// await onCallExport!(
|
|
||||||
// "Assigned",
|
|
||||||
// row['staff_id'].toString(),
|
|
||||||
// );
|
|
||||||
// }
|
|
||||||
},
|
|
||||||
child: Text(
|
|
||||||
row['today_pending'] ?? "",
|
|
||||||
// row['total_approval_pending'] ?? "",
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
style: _tableDataStyle,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Expanded(
|
|
||||||
flex: 2,
|
|
||||||
child: Material(
|
|
||||||
color: Colors.white,
|
|
||||||
child: Center(
|
|
||||||
child: InkWell(
|
|
||||||
// hoverColor: Color(0xFFEAF6F4),
|
|
||||||
onTap: () async {
|
|
||||||
print(
|
|
||||||
'Awaiting Proposal : ${row['total_in_progress']}',
|
|
||||||
);
|
|
||||||
|
|
||||||
handleDashboardNavigation(
|
|
||||||
context,
|
|
||||||
status: "In progress",
|
|
||||||
staffId: row['staff_id'] ?? '',
|
|
||||||
role: role,
|
|
||||||
);
|
|
||||||
// if (onCallExport != null) {
|
|
||||||
// await onCallExport!(
|
|
||||||
// 'InProgress',
|
|
||||||
// row['staff_id'].toString(),
|
|
||||||
// );
|
|
||||||
// }
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
child: Text(
|
|
||||||
row['today_in_progress'] ?? "",
|
|
||||||
// row['total_approval_pending'] ?? "",
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
style: _tableDataStyle,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Expanded(
|
|
||||||
flex: 2,
|
|
||||||
child: Material(
|
|
||||||
color: Colors.white,
|
|
||||||
child: Center(
|
|
||||||
child: InkWell(
|
|
||||||
hoverColor: Color(0xFFEAF6F4),
|
|
||||||
onTap: () async {
|
|
||||||
print(
|
|
||||||
'Awaiting Approval : ${row['total_completed']} - ${row['staff_id']}',
|
|
||||||
);
|
|
||||||
handleDashboardNavigation(
|
|
||||||
context,
|
|
||||||
status: "Completed",
|
|
||||||
staffId: row['staff_id'] ?? '',
|
|
||||||
role: role,
|
|
||||||
);
|
|
||||||
// if (onCallExport != null) {
|
|
||||||
// await onCallExport!(
|
|
||||||
// 'Completed',
|
|
||||||
// row['staff_id'].toString(),
|
|
||||||
// );
|
|
||||||
// }
|
|
||||||
},
|
|
||||||
child: Text(
|
|
||||||
row['today_completed'] ?? "",
|
|
||||||
// row['total_approval_pending'] ?? "",
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
style: _tableDataStyle,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Expanded(
|
|
||||||
flex: 2,
|
|
||||||
child: Material(
|
|
||||||
color: Colors.white,
|
|
||||||
child: Center(
|
|
||||||
child: InkWell(
|
|
||||||
hoverColor: Color(0xFFEAF6F4),
|
|
||||||
onTap: () async {
|
|
||||||
print(
|
|
||||||
'Awaiting Approval : ${row['total_completed']} - ${row['staff_id']}',
|
|
||||||
);
|
|
||||||
handleDashboardNavigation(
|
|
||||||
context,
|
|
||||||
status: 'PrevPending',
|
|
||||||
staffId: row['staff_id'] ?? '',
|
|
||||||
role: role,
|
|
||||||
);
|
|
||||||
// 2. Call the Export function
|
|
||||||
// We use await here so the 'isLoading' state is respected
|
|
||||||
// and errors are caught properly.
|
|
||||||
// if (onCallExport != null) {
|
|
||||||
// await onCallExport!(
|
|
||||||
// 'PrevPending',
|
|
||||||
// row['staff_id'].toString(),
|
|
||||||
// );
|
|
||||||
// }
|
|
||||||
},
|
|
||||||
child: Text(
|
|
||||||
safePending.toString() ?? "",
|
|
||||||
// row['total_approval_pending'] ?? "",
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
style: _tableDataStyle,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
|
|
||||||
// Expanded(
|
|
||||||
// flex: 2,
|
|
||||||
// child: Text(
|
|
||||||
// row['policy_created'] ?? "",
|
|
||||||
// // row['total_approval_pending'] ?? "",
|
|
||||||
// textAlign: TextAlign.center,
|
|
||||||
// style: _tableDataStyle,
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 8),
|
const SizedBox(height: 6),
|
||||||
// Header row
|
|
||||||
|
// ── Footer Total Row ────────────────────────────
|
||||||
Container(
|
Container(
|
||||||
padding: const EdgeInsets.symmetric(vertical: 8, horizontal: 12),
|
padding: const EdgeInsets.symmetric(vertical: 8, horizontal: 12),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: Color(0xFFF1F5F9),
|
color: const Color(0xFFF1F5F9),
|
||||||
// color: Color(0xFFE3F9F8),
|
|
||||||
borderRadius: BorderRadius.circular(10),
|
borderRadius: BorderRadius.circular(10),
|
||||||
),
|
),
|
||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
Expanded(
|
Expanded(flex: 2, child: Text("Total", textAlign: TextAlign.center, style: _headerStyle)),
|
||||||
flex: 2,
|
Expanded(flex: 2, child: Text(totalTodayAssigned.toString(), textAlign: TextAlign.center, style: _headerStyle)),
|
||||||
child: Text(
|
Expanded(flex: 2, child: Text(totalPending.toString(), textAlign: TextAlign.center, style: _headerStyle)),
|
||||||
"Total",
|
Expanded(flex: 2, child: Text(totalInProgress.toString(), textAlign: TextAlign.center, style: _headerStyle)),
|
||||||
textAlign: TextAlign.center,
|
Expanded(flex: 2, child: Text(totalCompleted.toString(), textAlign: TextAlign.center, style: _headerStyle)),
|
||||||
style: _headerStyle,
|
Expanded(flex: 2, child: Text(totalPrevPending.toString(), textAlign: TextAlign.center, style: _headerStyle)),
|
||||||
),
|
|
||||||
),
|
|
||||||
Expanded(
|
|
||||||
flex: 2,
|
|
||||||
child: Text(
|
|
||||||
totalTodayAssigned.toString(),
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
style: _headerStyle,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Expanded(
|
|
||||||
flex: 2,
|
|
||||||
child: Text(
|
|
||||||
totalPending.toString(),
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
style: _headerStyle,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Expanded(
|
|
||||||
flex: 2,
|
|
||||||
child: Text(
|
|
||||||
totalInProgress.toString(),
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
style: _headerStyle,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Expanded(
|
|
||||||
flex: 2,
|
|
||||||
child: Text(
|
|
||||||
totalCompleted.toString(),
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
style: _headerStyle,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Expanded(
|
|
||||||
flex: 2,
|
|
||||||
child: Text(
|
|
||||||
totalPrevPending.toString(),
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
style: _headerStyle,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -2383,3 +2008,74 @@ final _chartHeader = GoogleFonts.poppins(
|
|||||||
color: Colors.black,
|
color: Colors.black,
|
||||||
fontWeight: FontWeight.w500,
|
fontWeight: FontWeight.w500,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// ─── Helper Widgets ──────────────────────────────────────────────────────────
|
||||||
|
|
||||||
|
Widget _dataCell(String text, {int flex = 2}) {
|
||||||
|
return Expanded(
|
||||||
|
flex: flex,
|
||||||
|
child: Text(
|
||||||
|
text,
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
style: GoogleFonts.inter(
|
||||||
|
fontSize: 11,
|
||||||
|
fontWeight: FontWeight.w500,
|
||||||
|
color: const Color(0xFF2C3E3D),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
// ─── Hoverable Row Widget ───────────────────────────────────────────────────
|
||||||
|
|
||||||
|
class _HoverableRow extends StatefulWidget {
|
||||||
|
final Widget child;
|
||||||
|
final VoidCallback onTap;
|
||||||
|
|
||||||
|
const _HoverableRow({
|
||||||
|
required this.child,
|
||||||
|
required this.onTap,
|
||||||
|
});
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<_HoverableRow> createState() => _HoverableRowState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _HoverableRowState extends State<_HoverableRow> {
|
||||||
|
bool _isHovered = false;
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return MouseRegion(
|
||||||
|
onEnter: (_) => setState(() => _isHovered = true),
|
||||||
|
onExit: (_) => setState(() => _isHovered = false),
|
||||||
|
cursor: SystemMouseCursors.click,
|
||||||
|
child: GestureDetector(
|
||||||
|
onTap: widget.onTap,
|
||||||
|
child: AnimatedContainer(
|
||||||
|
duration: const Duration(milliseconds: 180),
|
||||||
|
curve: Curves.easeInOut,
|
||||||
|
margin: const EdgeInsets.symmetric(vertical: 2, horizontal: 4),
|
||||||
|
padding: const EdgeInsets.symmetric(vertical: 10, horizontal: 12),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: _isHovered ? const Color(0xFFD4F3EF) : Colors.white,
|
||||||
|
borderRadius: BorderRadius.circular(10),
|
||||||
|
border: Border.all(
|
||||||
|
color: _isHovered ? const Color(0xFF4ABFB5) : Colors.transparent,
|
||||||
|
width: 1.2,
|
||||||
|
),
|
||||||
|
boxShadow: _isHovered
|
||||||
|
? [
|
||||||
|
BoxShadow(
|
||||||
|
color: const Color(0xFF4ABFB5).withOpacity(0.18),
|
||||||
|
blurRadius: 8,
|
||||||
|
offset: const Offset(0, 3),
|
||||||
|
),
|
||||||
|
]
|
||||||
|
: [],
|
||||||
|
),
|
||||||
|
child: widget.child,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -298,6 +298,25 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
|
|||||||
print('dashboardStatus - $dashboardStatus');
|
print('dashboardStatus - $dashboardStatus');
|
||||||
print('dashboardStaffId - $dashboardStaffId');
|
print('dashboardStaffId - $dashboardStaffId');
|
||||||
|
|
||||||
|
// if (managerId != null &&
|
||||||
|
// dashboardKey != null &&
|
||||||
|
// dashboardStatus != null &&
|
||||||
|
// dashboardStaffId != null) {
|
||||||
|
// print("DASHBOARD STATus-$dashboardStatus -- $dashboardStaffId -");
|
||||||
|
// SelectedStatus = dashboardStatus;
|
||||||
|
// SelectedStaffId = dashboardStaffId;
|
||||||
|
// getStaffList(
|
||||||
|
// managerId,
|
||||||
|
// roleId,
|
||||||
|
// SelectedStatus: dashboardStatus,
|
||||||
|
// SelectedStaffId: dashboardStaffId,
|
||||||
|
// );
|
||||||
|
// } else {
|
||||||
|
// print('ELSE');
|
||||||
|
// getStaffList(managerId, roleId);
|
||||||
|
// }
|
||||||
|
|
||||||
|
// AFTER — clear dashboardKey from prefs immediately after reading it:
|
||||||
if (managerId != null &&
|
if (managerId != null &&
|
||||||
dashboardKey != null &&
|
dashboardKey != null &&
|
||||||
dashboardStatus != null &&
|
dashboardStatus != null &&
|
||||||
@ -305,12 +324,23 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
|
|||||||
print("DASHBOARD STATus-$dashboardStatus -- $dashboardStaffId -");
|
print("DASHBOARD STATus-$dashboardStatus -- $dashboardStaffId -");
|
||||||
SelectedStatus = dashboardStatus;
|
SelectedStatus = dashboardStatus;
|
||||||
SelectedStaffId = dashboardStaffId;
|
SelectedStaffId = dashboardStaffId;
|
||||||
|
|
||||||
|
// ✅ FIX: Clear dashboard keys from SharedPreferences RIGHT NOW
|
||||||
|
// so that auto-refresh (30s timer) never re-applies dashboard dates
|
||||||
|
await prefs.remove('dashboardKeyProvider');
|
||||||
|
await prefs.remove('dashboardStatusProvider');
|
||||||
|
await prefs.remove('dashboardStaffIdProvider');
|
||||||
|
|
||||||
getStaffList(
|
getStaffList(
|
||||||
managerId,
|
managerId,
|
||||||
roleId,
|
roleId,
|
||||||
SelectedStatus: dashboardStatus,
|
SelectedStatus: dashboardStatus,
|
||||||
SelectedStaffId: dashboardStaffId,
|
SelectedStaffId: dashboardStaffId,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// ✅ FIX: After first load, clear dashboardKey in memory too
|
||||||
|
// so getStaffList's date logic uses normal path on next call
|
||||||
|
dashboardKey = null;
|
||||||
} else {
|
} else {
|
||||||
print('ELSE');
|
print('ELSE');
|
||||||
getStaffList(managerId, roleId);
|
getStaffList(managerId, roleId);
|
||||||
@ -519,24 +549,27 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
|
|||||||
|
|
||||||
Future<void> autoRefrshfilterDateRange() async {
|
Future<void> autoRefrshfilterDateRange() async {
|
||||||
print('autorefrshfilterDateRange');
|
print('autorefrshfilterDateRange');
|
||||||
// setState(() async {
|
|
||||||
final prefs = await SharedPreferences.getInstance();
|
final prefs = await SharedPreferences.getInstance();
|
||||||
|
|
||||||
// _formKey.currentState?.reset();
|
// ✅ FIX: Always clear dashboard keys before auto-refresh
|
||||||
|
// This is a safety net — ensures stale dashboardKey never leaks into timer calls
|
||||||
|
if (dashboardKey == 'fromDashboard') {
|
||||||
|
dashboardKey = null;
|
||||||
|
_dashboardInitHandled = false;
|
||||||
|
await prefs.remove('dashboardKeyProvider');
|
||||||
|
await prefs.remove('dashboardStatusProvider');
|
||||||
|
await prefs.remove('dashboardStaffIdProvider');
|
||||||
|
}
|
||||||
|
|
||||||
final int parsedManagerId = int.tryParse(managerId.toString()) ?? 0;
|
final int parsedManagerId = int.tryParse(managerId.toString()) ?? 0;
|
||||||
print('autorefrshfilterDateRange 1');
|
|
||||||
getStaffList(
|
getStaffList(
|
||||||
// managerId,
|
|
||||||
parsedManagerId,
|
parsedManagerId,
|
||||||
roleId,
|
roleId,
|
||||||
SelectedStatus: SelectedStatus ?? '',
|
SelectedStatus: SelectedStatus ?? '',
|
||||||
SelectedStaffId: SelectedStaffId ?? '',
|
SelectedStaffId: SelectedStaffId ?? '',
|
||||||
);
|
);
|
||||||
autoRefreshIndex = selectedIndex;
|
autoRefreshIndex = selectedIndex;
|
||||||
print('autoRefreshIndex - $autoRefreshIndex');
|
|
||||||
_searchStaffController.clear();
|
_searchStaffController.clear();
|
||||||
print('refrshfilterDateRange 2');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> refrshfilterDateRange() async {
|
Future<void> refrshfilterDateRange() async {
|
||||||
@ -699,34 +732,22 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
|
|||||||
});
|
});
|
||||||
final today = DateTime.now();
|
final today = DateTime.now();
|
||||||
final DateTime yesterday = today.subtract(const Duration(days: 1));
|
final DateTime yesterday = today.subtract(const Duration(days: 1));
|
||||||
final DateTime fromDate = DateTime(2025, 10, 1); // hardcoded Date
|
final DateTime fromDate = DateTime(2025, 10, 1);
|
||||||
controllers['startDate']?.text = dateFormat.format(fromDate);
|
controllers['startDate']?.text = dateFormat.format(fromDate);
|
||||||
controllers['endDate']?.text = dateFormat.format(yesterday);
|
controllers['endDate']?.text = dateFormat.format(yesterday);
|
||||||
print('UnA813 => Fns called => $managerId | $role');
|
print('UnA813 => Fns called => $managerId | $role');
|
||||||
|
|
||||||
// For PREV PENDING → set date range until yesterday
|
|
||||||
// Change to dd-MM-yyyy
|
|
||||||
// final dateFormat = DateFormat('dd-MM-yyyy');
|
|
||||||
// final yesterday = today.subtract(Duration(days: 1));
|
|
||||||
|
|
||||||
fromDt = _dashboardInitHandled ? controllers['startDate']?.text : '';
|
fromDt = _dashboardInitHandled ? controllers['startDate']?.text : '';
|
||||||
toDt = _dashboardInitHandled ? controllers['endDate']?.text : '';
|
toDt = _dashboardInitHandled ? controllers['endDate']?.text : '';
|
||||||
// fromDt = dateFormat.format(yesterday.subtract(Duration(days: 15)));
|
|
||||||
// toDt = dateFormat.format(yesterday);
|
|
||||||
|
|
||||||
print('PrevPending FROM TO - $fromDt - $toDt');
|
print('PrevPending FROM TO - $fromDt - $toDt');
|
||||||
} else if (dashboardKey == 'fromDashboard' &&
|
} else if (dashboardKey == 'fromDashboard' &&
|
||||||
SelectedStatus != "PrevPending" &&
|
SelectedStatus != "PrevPending" &&
|
||||||
SelectedStatus != '') {
|
SelectedStatus != '') {
|
||||||
// For PREV PENDING → set date range until yesterday
|
|
||||||
final today = DateTime.now();
|
final today = DateTime.now();
|
||||||
print('A913 => Fns called => $managerId | $role');
|
print('A913 => Fns called => $managerId | $role');
|
||||||
// Change to dd-MM-yyyy
|
|
||||||
final dateFormat = DateFormat('dd-MM-yyyy');
|
final dateFormat = DateFormat('dd-MM-yyyy');
|
||||||
|
|
||||||
// fromDt = dateFormat.format(today);
|
|
||||||
// toDt = dateFormat.format(today);
|
|
||||||
|
|
||||||
fromDt = _dashboardInitHandled ? controllers['startDate']?.text : '';
|
fromDt = _dashboardInitHandled ? controllers['startDate']?.text : '';
|
||||||
toDt = _dashboardInitHandled ? controllers['endDate']?.text : '';
|
toDt = _dashboardInitHandled ? controllers['endDate']?.text : '';
|
||||||
print('End Date: ${controllers['endDate']?.text}');
|
print('End Date: ${controllers['endDate']?.text}');
|
||||||
@ -741,7 +762,6 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
|
|||||||
|
|
||||||
final today = DateTime.now();
|
final today = DateTime.now();
|
||||||
fromDt = dateFormat.format(today.subtract(Duration(days: 4)));
|
fromDt = dateFormat.format(today.subtract(Duration(days: 4)));
|
||||||
// fromDt = dateFormat.format(today);
|
|
||||||
toDt = dateFormat.format(today);
|
toDt = dateFormat.format(today);
|
||||||
|
|
||||||
print('Enq FROM TO - $fromDt - $toDt');
|
print('Enq FROM TO - $fromDt - $toDt');
|
||||||
@ -753,15 +773,13 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
|
|||||||
print('A12131 => Fns called => $managerId | $role');
|
print('A12131 => Fns called => $managerId | $role');
|
||||||
final dateFormat = DateFormat('dd-MM-yyyy');
|
final dateFormat = DateFormat('dd-MM-yyyy');
|
||||||
final today = DateTime.now();
|
final today = DateTime.now();
|
||||||
// final yesterday = today.subtract(Duration(days: 1));
|
|
||||||
// fromDt = dateFormat.format(yesterday.subtract(Duration(days: 15))); // Dont Delete any doubt Ref Suren
|
|
||||||
fromDt = dateFormat.format(today.subtract(const Duration(days: 4)));
|
fromDt = dateFormat.format(today.subtract(const Duration(days: 4)));
|
||||||
toDt = dateFormat.format(today);
|
toDt = dateFormat.format(today);
|
||||||
|
|
||||||
setState(() {
|
setState(() {
|
||||||
controllers['startDate']?.text = fromDt;
|
controllers['startDate']?.text = fromDt;
|
||||||
controllers['endDate']?.text = toDt;
|
controllers['endDate']?.text = toDt;
|
||||||
_resetKeyEnable = false; // ask suren Never forgot
|
_resetKeyEnable = false;
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
print('A13131 => Fns called => $managerId | $role');
|
print('A13131 => Fns called => $managerId | $role');
|
||||||
@ -784,9 +802,6 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
|
|||||||
? controllers['startDate']?.text
|
? controllers['startDate']?.text
|
||||||
: fromDt,
|
: fromDt,
|
||||||
toDate: _dashboardInitHandled ? controllers['endDate']?.text : toDt,
|
toDate: _dashboardInitHandled ? controllers['endDate']?.text : toDt,
|
||||||
// selectedStatus: (finalStatus != '' && finalStatus != 'PrevPending')
|
|
||||||
// ? finalStatus
|
|
||||||
// : '',
|
|
||||||
selectedStatus:
|
selectedStatus:
|
||||||
(SelectedStatus != '' && SelectedStatus != 'PrevPending')
|
(SelectedStatus != '' && SelectedStatus != 'PrevPending')
|
||||||
? SelectedStatus
|
? SelectedStatus
|
||||||
@ -809,13 +824,10 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
|
|||||||
controllers['startDate']?.text = fromDate;
|
controllers['startDate']?.text = fromDate;
|
||||||
controllers['endDate']?.text = toDate;
|
controllers['endDate']?.text = toDate;
|
||||||
|
|
||||||
|
|
||||||
if (data is List) {
|
if (data is List) {
|
||||||
getStaffData = List<Map<String, dynamic>>.from(data);
|
getStaffData = List<Map<String, dynamic>>.from(data);
|
||||||
|
|
||||||
originalData = List<Map<String, dynamic>>.from(data);
|
originalData = List<Map<String, dynamic>>.from(data);
|
||||||
|
|
||||||
// Split data immediately after fetching
|
|
||||||
inProgressData = originalData
|
inProgressData = originalData
|
||||||
.where((item) => item['enquiry_status'] != 'Completed')
|
.where((item) => item['enquiry_status'] != 'Completed')
|
||||||
.toList();
|
.toList();
|
||||||
@ -827,12 +839,6 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
|
|||||||
.toList();
|
.toList();
|
||||||
print('completedData - $completedData');
|
print('completedData - $completedData');
|
||||||
|
|
||||||
// filteredData now holds the currently displayed tab's data (without search)
|
|
||||||
// filteredData = (selectedIndex == 0)
|
|
||||||
// ? inProgressData
|
|
||||||
// : completedData;
|
|
||||||
|
|
||||||
// 👇 IMPORTANT: Set filteredData based on current tab
|
|
||||||
filteredData = (selectedIndex == 0)
|
filteredData = (selectedIndex == 0)
|
||||||
? List.from(inProgressData)
|
? List.from(inProgressData)
|
||||||
: List.from(completedData);
|
: List.from(completedData);
|
||||||
@ -852,6 +858,16 @@ class EnquiryStaffState extends ConsumerState<EnquiryListStaffInline> {
|
|||||||
originalData = getStaffData;
|
originalData = getStaffData;
|
||||||
filteredData = List.from(originalData);
|
filteredData = List.from(originalData);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// ✅ FIX CHANGE 2: Clear dashboardKey AFTER first successful load
|
||||||
|
// so all subsequent auto-refresh timer calls (every 30s) use
|
||||||
|
// normal date logic instead of re-applying dashboard dates
|
||||||
|
if (dashboardKey == 'fromDashboard') {
|
||||||
|
dashboardKey = null;
|
||||||
|
_dashboardInitHandled = false;
|
||||||
|
print('✅ dashboardKey cleared after first successful load');
|
||||||
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
getStaffData = [];
|
getStaffData = [];
|
||||||
originalData = [];
|
originalData = [];
|
||||||
|
|||||||
@ -15,8 +15,8 @@
|
|||||||
the `--base-href` argument provided to `flutter build`.
|
the `--base-href` argument provided to `flutter build`.
|
||||||
-->
|
-->
|
||||||
<!-- <base href="$FLUTTER_BASE_HREF"> -->
|
<!-- <base href="$FLUTTER_BASE_HREF"> -->
|
||||||
<base href="/partner/"> <!-- Live build: also check env.dart (line 8) -->
|
<!-- <base href="/partner/"> Live build: also check env.dart (line 8) -->
|
||||||
<!-- <base href="/nhance/partner/app/"> <!– Testing build: also check env.dart (line 9) –>-->
|
<base href="/nhance/partner/app/"> <!-- Testing build: also check env.dart (line 9) -->
|
||||||
<!-- <base href="{Env.baseHref}">-->
|
<!-- <base href="{Env.baseHref}">-->
|
||||||
|
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user