Merge code
This commit is contained in:
parent
a86263ce6b
commit
09dcf56c5b
File diff suppressed because one or more lines are too long
@ -459,7 +459,7 @@ class ApiService {
|
|||||||
} else if (path == 'staff_pending_summary') {
|
} else if (path == 'staff_pending_summary') {
|
||||||
pathVal = 'dashboard/downloadStaffPendingSummaryExcel?manager_id=$managerId';
|
pathVal = 'dashboard/downloadStaffPendingSummaryExcel?manager_id=$managerId';
|
||||||
} else if (path == 'staff_pending_summary_by_id') {
|
} else if (path == 'staff_pending_summary_by_id') {
|
||||||
pathVal = 'dashboard/downloadStaffPendingSummaryExcelByID?manager_id=$managerId&staff_id=$id';
|
pathVal = 'dashboard/downloadStaffPendingSummaryExcelByID?manager_id=$managerId&staff_id=$id&status=$month';
|
||||||
} else {
|
} else {
|
||||||
//NoBusiness
|
//NoBusiness
|
||||||
pathVal =
|
pathVal =
|
||||||
|
|||||||
@ -113,8 +113,7 @@ class _DashboardState extends ConsumerState<LiveDashboard> {
|
|||||||
Future<void> getExportExcel() async {
|
Future<void> getExportExcel() async {
|
||||||
final prefmanagerid = ref.read(managerIdProvider);
|
final prefmanagerid = ref.read(managerIdProvider);
|
||||||
|
|
||||||
|
final path = "staff_pending_summary";
|
||||||
final path = "staff_level_pending_summary";
|
|
||||||
final id = '';
|
final id = '';
|
||||||
final month = 'current';
|
final month = 'current';
|
||||||
|
|
||||||
@ -131,6 +130,32 @@ class _DashboardState extends ConsumerState<LiveDashboard> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<void> getExportExcel2(String status, String staffId) async {
|
||||||
|
final prefmanagerid = ref.read(managerIdProvider);
|
||||||
|
|
||||||
|
// Use the parameters passed from the widget
|
||||||
|
final path = "staff_pending_summary_by_id";
|
||||||
|
final id = staffId;
|
||||||
|
final month = status;
|
||||||
|
|
||||||
|
try {
|
||||||
|
setState(() => isLoading = true);
|
||||||
|
|
||||||
|
final response = await apiService.generateChartExcel(
|
||||||
|
path,
|
||||||
|
id,
|
||||||
|
month,
|
||||||
|
prefmanagerid
|
||||||
|
);
|
||||||
|
|
||||||
|
return response;
|
||||||
|
} catch (e) {
|
||||||
|
print('Export Error: $e');
|
||||||
|
} finally {
|
||||||
|
if (mounted) setState(() => isLoading = false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Future<void> handleEdit(String id) async {
|
Future<void> handleEdit(String id) async {
|
||||||
// Navigator.pop(context);
|
// Navigator.pop(context);
|
||||||
print('EDITStaff');
|
print('EDITStaff');
|
||||||
@ -583,6 +608,7 @@ class _DashboardState extends ConsumerState<LiveDashboard> {
|
|||||||
role: role!,
|
role: role!,
|
||||||
onRefresh: refresh,
|
onRefresh: refresh,
|
||||||
onExportExcel: getExportExcel,
|
onExportExcel: getExportExcel,
|
||||||
|
onCallExport: getExportExcel2,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
// if (role == 'handler') ...[
|
// if (role == 'handler') ...[
|
||||||
@ -1186,6 +1212,7 @@ 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,
|
||||||
@ -1195,6 +1222,7 @@ 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
|
||||||
@ -1459,7 +1487,7 @@ class othersPendings extends StatelessWidget {
|
|||||||
child: Center(
|
child: Center(
|
||||||
child: InkWell(
|
child: InkWell(
|
||||||
hoverColor: Color(0xFFEAF6F4),
|
hoverColor: Color(0xFFEAF6F4),
|
||||||
onTap: () {
|
onTap: () async {
|
||||||
print(
|
print(
|
||||||
'total_assigned_today : ${row['total_assigned']}',
|
'total_assigned_today : ${row['total_assigned']}',
|
||||||
);
|
);
|
||||||
@ -1471,6 +1499,12 @@ class othersPendings extends StatelessWidget {
|
|||||||
staffId: row['staff_id'] ?? '',
|
staffId: row['staff_id'] ?? '',
|
||||||
role: role,
|
role: role,
|
||||||
);
|
);
|
||||||
|
if (onCallExport != null) {
|
||||||
|
await onCallExport!(
|
||||||
|
"TodayAssigned",
|
||||||
|
row['staff_id'].toString(),
|
||||||
|
);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
child: Text(
|
child: Text(
|
||||||
row['today_assigned'] ?? "",
|
row['today_assigned'] ?? "",
|
||||||
@ -1489,7 +1523,7 @@ class othersPendings extends StatelessWidget {
|
|||||||
child: Center(
|
child: Center(
|
||||||
child: InkWell(
|
child: InkWell(
|
||||||
hoverColor: Color(0xFFEAF6F4),
|
hoverColor: Color(0xFFEAF6F4),
|
||||||
onTap: () {
|
onTap: () async {
|
||||||
print(
|
print(
|
||||||
'total_assigned : ${row['total_assigned']}',
|
'total_assigned : ${row['total_assigned']}',
|
||||||
);
|
);
|
||||||
@ -1500,6 +1534,12 @@ class othersPendings extends StatelessWidget {
|
|||||||
staffId: row['staff_id'] ?? '',
|
staffId: row['staff_id'] ?? '',
|
||||||
role: role,
|
role: role,
|
||||||
);
|
);
|
||||||
|
if (onCallExport != null) {
|
||||||
|
await onCallExport!(
|
||||||
|
"Assigned",
|
||||||
|
row['staff_id'].toString(),
|
||||||
|
);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
child: Text(
|
child: Text(
|
||||||
row['today_pending'] ?? "",
|
row['today_pending'] ?? "",
|
||||||
@ -1518,7 +1558,7 @@ class othersPendings extends StatelessWidget {
|
|||||||
child: Center(
|
child: Center(
|
||||||
child: InkWell(
|
child: InkWell(
|
||||||
// hoverColor: Color(0xFFEAF6F4),
|
// hoverColor: Color(0xFFEAF6F4),
|
||||||
onTap: () {
|
onTap: () async {
|
||||||
print(
|
print(
|
||||||
'Awaiting Proposal : ${row['total_in_progress']}',
|
'Awaiting Proposal : ${row['total_in_progress']}',
|
||||||
);
|
);
|
||||||
@ -1529,6 +1569,13 @@ class othersPendings extends StatelessWidget {
|
|||||||
staffId: row['staff_id'] ?? '',
|
staffId: row['staff_id'] ?? '',
|
||||||
role: role,
|
role: role,
|
||||||
);
|
);
|
||||||
|
if (onCallExport != null) {
|
||||||
|
await onCallExport!(
|
||||||
|
'InProgress',
|
||||||
|
row['staff_id'].toString(),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
child: Text(
|
child: Text(
|
||||||
@ -1558,6 +1605,12 @@ class othersPendings extends StatelessWidget {
|
|||||||
staffId: row['staff_id'] ?? '',
|
staffId: row['staff_id'] ?? '',
|
||||||
role: role,
|
role: role,
|
||||||
);
|
);
|
||||||
|
if (onCallExport != null) {
|
||||||
|
await onCallExport!(
|
||||||
|
'Completed',
|
||||||
|
row['staff_id'].toString(),
|
||||||
|
);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
child: Text(
|
child: Text(
|
||||||
row['today_completed'] ?? "",
|
row['today_completed'] ?? "",
|
||||||
@ -1586,6 +1639,16 @@ class othersPendings extends StatelessWidget {
|
|||||||
staffId: row['staff_id'] ?? '',
|
staffId: row['staff_id'] ?? '',
|
||||||
role: role,
|
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(
|
child: Text(
|
||||||
safePending.toString() ?? "",
|
safePending.toString() ?? "",
|
||||||
@ -2230,6 +2293,8 @@ Future<void> handleDashboardNavigation(
|
|||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
final _headerStyle = GoogleFonts.inter(
|
final _headerStyle = GoogleFonts.inter(
|
||||||
fontWeight: FontWeight.w600,
|
fontWeight: FontWeight.w600,
|
||||||
fontSize: 11.5,
|
fontSize: 11.5,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user