fix compilations
This commit is contained in:
@@ -179,7 +179,7 @@ class ClientCreateOrderRepositoryImpl implements ClientCreateOrderRepositoryInte
|
||||
.date(orderTimestamp)
|
||||
.startDate(startTimestamp)
|
||||
.endDate(endTimestamp)
|
||||
.recurringDays(order.recurringDays)
|
||||
.recurringDays(fdc.AnyValue(order.recurringDays))
|
||||
.execute();
|
||||
|
||||
final String orderId = orderResult.data.order_insert.id;
|
||||
@@ -299,7 +299,7 @@ class ClientCreateOrderRepositoryImpl implements ClientCreateOrderRepositoryInte
|
||||
.status(dc.OrderStatus.POSTED)
|
||||
.date(orderTimestamp)
|
||||
.startDate(startTimestamp)
|
||||
.permanentDays(order.permanentDays)
|
||||
.permanentDays(fdc.AnyValue(order.permanentDays))
|
||||
.execute();
|
||||
|
||||
final String orderId = orderResult.data.order_insert.id;
|
||||
|
||||
@@ -332,8 +332,8 @@ class _DailyOpsReportPageState extends State<DailyOpsReportPage> {
|
||||
|
||||
// Shift List
|
||||
if (report.shifts.isEmpty)
|
||||
const Padding(
|
||||
padding: EdgeInsets.symmetric(vertical: 40),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 40),
|
||||
child: Center(
|
||||
child: Text(context.t.client_reports.daily_ops_report.no_shifts_today),
|
||||
),
|
||||
|
||||
@@ -216,53 +216,7 @@ class _NoShowReportPageState extends State<NoShowReportPage> {
|
||||
(worker) => _WorkerCard(worker: worker),
|
||||
),
|
||||
|
||||
const SizedBox(height: 24),
|
||||
|
||||
// ── Reliability Insights box (matches prototype) ──
|
||||
Container(
|
||||
width: double.infinity,
|
||||
padding: const EdgeInsets.all(16),
|
||||
decoration: BoxDecoration(
|
||||
color: const Color(0xFFFFF8E1),
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
border: Border.all(
|
||||
color: UiColors.textWarning.withOpacity(0.3),
|
||||
),
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
'💡 ${context.t.client_reports.no_show_report.insights.title}',
|
||||
style: const TextStyle(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: UiColors.textPrimary,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
_InsightLine(
|
||||
text:
|
||||
'· ${context.t.client_reports.no_show_report.insights.insight_1.prefix}${context.t.client_reports.no_show_report.insights.insight_1.highlight(rate: report.noShowRate.toStringAsFixed(1))}${context.t.client_reports.no_show_report.insights.insight_1.suffix(comparison: report.noShowRate < 5 ? 'below' : 'above')}',
|
||||
),
|
||||
if (report.flaggedWorkers.any(
|
||||
(w) => w.noShowCount > 1,
|
||||
))
|
||||
_InsightLine(
|
||||
text:
|
||||
'· ${context.t.client_reports.no_show_report.insights.insight_2.highlight(count: report.flaggedWorkers.where((w) => w.noShowCount > 1).length.toString())} ${context.t.client_reports.no_show_report.insights.insight_2.suffix}',
|
||||
bold: true,
|
||||
),
|
||||
_InsightLine(
|
||||
text:
|
||||
'· ${context.t.client_reports.no_show_report.insights.insight_3.prefix}${context.t.client_reports.no_show_report.insights.insight_3.highlight}${context.t.client_reports.no_show_report.insights.insight_3.suffix}',
|
||||
bold: true,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
const SizedBox(height: 100),
|
||||
const SizedBox(height: 40),
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -349,7 +303,7 @@ class _WorkerCard extends StatelessWidget {
|
||||
|
||||
const _WorkerCard({required this.worker});
|
||||
|
||||
String _riskLabel(int count) {
|
||||
String _riskLabel(BuildContext context, int count) {
|
||||
if (count >= 3) return context.t.client_reports.no_show_report.risks.high;
|
||||
if (count == 2) return context.t.client_reports.no_show_report.risks.medium;
|
||||
return context.t.client_reports.no_show_report.risks.low;
|
||||
@@ -369,7 +323,7 @@ class _WorkerCard extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final riskLabel = _riskLabel(worker.noShowCount);
|
||||
final riskLabel = _riskLabel(context, worker.noShowCount);
|
||||
final riskColor = _riskColor(worker.noShowCount);
|
||||
final riskBg = _riskBg(worker.noShowCount);
|
||||
|
||||
@@ -487,25 +441,3 @@ class _WorkerCard extends StatelessWidget {
|
||||
}
|
||||
|
||||
// ── Insight line ─────────────────────────────────────────────────────────────
|
||||
class _InsightLine extends StatelessWidget {
|
||||
final String text;
|
||||
final bool bold;
|
||||
|
||||
const _InsightLine({required this.text, this.bold = false});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(bottom: 6),
|
||||
child: Text(
|
||||
text,
|
||||
style: TextStyle(
|
||||
fontSize: 13,
|
||||
color: UiColors.textPrimary,
|
||||
fontWeight: bold ? FontWeight.w600 : FontWeight.normal,
|
||||
height: 1.4,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -316,6 +316,7 @@ class _ReportsPageState extends State<ReportsPage>
|
||||
color: UiColors.textPrimary,
|
||||
),
|
||||
),
|
||||
/*
|
||||
TextButton.icon(
|
||||
onPressed: () {},
|
||||
icon: const Icon(UiIcons.download, size: 16),
|
||||
@@ -328,6 +329,7 @@ class _ReportsPageState extends State<ReportsPage>
|
||||
tapTargetSize: MaterialTapTargetSize.shrinkWrap,
|
||||
),
|
||||
),
|
||||
*/
|
||||
],
|
||||
),
|
||||
|
||||
@@ -392,89 +394,7 @@ class _ReportsPageState extends State<ReportsPage>
|
||||
|
||||
const SizedBox(height: 24),
|
||||
|
||||
// AI Insights
|
||||
Container(
|
||||
width: double.infinity,
|
||||
padding: const EdgeInsets.all(16),
|
||||
decoration: BoxDecoration(
|
||||
color: UiColors.tagInProgress.withOpacity(0.3),
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: UiColors.black.withOpacity(0.02),
|
||||
blurRadius: 2,
|
||||
offset: const Offset(0, 1),
|
||||
),
|
||||
],
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
'💡 ${context.t.client_reports.ai_insights.title}',
|
||||
style: const TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: UiColors.textPrimary,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
_InsightRow(
|
||||
children: [
|
||||
TextSpan(
|
||||
text: context.t.client_reports.ai_insights
|
||||
.insight_1.prefix),
|
||||
TextSpan(
|
||||
text: context.t.client_reports.ai_insights
|
||||
.insight_1.highlight,
|
||||
style: const TextStyle(
|
||||
fontWeight: FontWeight.bold),
|
||||
),
|
||||
TextSpan(
|
||||
text: context.t.client_reports.ai_insights
|
||||
.insight_1.suffix,
|
||||
),
|
||||
],
|
||||
),
|
||||
_InsightRow(
|
||||
children: [
|
||||
TextSpan(
|
||||
text: context.t.client_reports.ai_insights
|
||||
.insight_2.prefix),
|
||||
TextSpan(
|
||||
text: context.t.client_reports.ai_insights
|
||||
.insight_2.highlight,
|
||||
style: const TextStyle(
|
||||
fontWeight: FontWeight.bold),
|
||||
),
|
||||
TextSpan(
|
||||
text: context.t.client_reports.ai_insights
|
||||
.insight_2.suffix,
|
||||
),
|
||||
],
|
||||
),
|
||||
_InsightRow(
|
||||
children: [
|
||||
TextSpan(
|
||||
text: context.t.client_reports.ai_insights
|
||||
.insight_3.prefix,
|
||||
),
|
||||
TextSpan(
|
||||
text: context.t.client_reports.ai_insights
|
||||
.insight_3.highlight,
|
||||
style: const TextStyle(
|
||||
fontWeight: FontWeight.bold),
|
||||
),
|
||||
TextSpan(
|
||||
text: context.t.client_reports.ai_insights
|
||||
.insight_3.suffix),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
const SizedBox(height: 100),
|
||||
const SizedBox(height: 40),
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -661,36 +581,3 @@ class _ReportCard extends StatelessWidget {
|
||||
}
|
||||
}
|
||||
|
||||
class _InsightRow extends StatelessWidget {
|
||||
final List<InlineSpan> children;
|
||||
|
||||
const _InsightRow({required this.children});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(bottom: 8.0),
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
const Text(
|
||||
'• ',
|
||||
style: TextStyle(color: UiColors.textSecondary, fontSize: 14),
|
||||
),
|
||||
Expanded(
|
||||
child: Text.rich(
|
||||
TextSpan(
|
||||
style: const TextStyle(
|
||||
fontSize: 14,
|
||||
color: UiColors.textSecondary,
|
||||
height: 1.4,
|
||||
),
|
||||
children: children,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -215,57 +215,12 @@ class AuthRepositoryImpl implements AuthRepositoryInterface {
|
||||
staffRecord = staffResponse.data.staffs.first;
|
||||
}
|
||||
|
||||
return _setSession(firebaseUser.uid, user, staffRecord);
|
||||
}
|
||||
|
||||
@override
|
||||
Future<void> restoreSession() async {
|
||||
final User? firebaseUser = await _service.auth.authStateChanges().first;
|
||||
if (firebaseUser == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Reuse the same logic as verifyOtp to fetch user/staff and set session
|
||||
// We can't reuse verifyOtp directly because it requires verificationId/smsCode
|
||||
// So we fetch the data manually here.
|
||||
|
||||
final QueryResult<GetUserByIdData, GetUserByIdVariables> response =
|
||||
await _service.run(
|
||||
() => _service.connector.getUserById(id: firebaseUser.uid).execute(),
|
||||
requiresAuthentication: false,
|
||||
);
|
||||
final GetUserByIdUser? user = response.data.user;
|
||||
|
||||
if (user == null) {
|
||||
// User authenticated in Firebase but not in our DB?
|
||||
// Should likely sign out or handle gracefully.
|
||||
await _service.auth.signOut();
|
||||
return;
|
||||
}
|
||||
|
||||
final QueryResult<GetStaffByUserIdData, GetStaffByUserIdVariables>
|
||||
staffResponse = await _service.run(
|
||||
() => _service.connector.getStaffByUserId(userId: firebaseUser.uid).execute(),
|
||||
requiresAuthentication: false,
|
||||
);
|
||||
|
||||
final GetStaffByUserIdStaffs? staffRecord =
|
||||
staffResponse.data.staffs.firstOrNull;
|
||||
|
||||
_setSession(firebaseUser.uid, user, staffRecord);
|
||||
}
|
||||
|
||||
domain.User _setSession(
|
||||
String uid,
|
||||
GetUserByIdUser? user,
|
||||
GetStaffByUserIdStaffs? staffRecord,
|
||||
) {
|
||||
//TO-DO: create(registration) user and staff account
|
||||
//TO-DO: save user data locally
|
||||
final domain.User domainUser = domain.User(
|
||||
id: uid,
|
||||
id: firebaseUser.uid,
|
||||
email: user?.email ?? '',
|
||||
phone: user?.phone, // Use user.phone locally if needed, but domain.User expects it
|
||||
phone: user?.phone,
|
||||
role: user?.role.stringValue ?? 'USER',
|
||||
);
|
||||
final domain.Staff? domainStaff = staffRecord == null
|
||||
@@ -288,4 +243,5 @@ class AuthRepositoryImpl implements AuthRepositoryInterface {
|
||||
);
|
||||
return domainUser;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -21,6 +21,4 @@ abstract interface class AuthRepositoryInterface {
|
||||
/// Signs out the current user.
|
||||
Future<void> signOut();
|
||||
|
||||
/// Restores the user session if a user is already signed in.
|
||||
Future<void> restoreSession();
|
||||
}
|
||||
|
||||
@@ -30,6 +30,7 @@ class StaffAuthenticationModule extends Module {
|
||||
// Repositories
|
||||
i.addLazySingleton<ProfileSetupRepository>(ProfileSetupRepositoryImpl.new);
|
||||
i.addLazySingleton<PlaceRepository>(PlaceRepositoryImpl.new);
|
||||
i.addLazySingleton<AuthRepositoryInterface>(AuthRepositoryImpl.new);
|
||||
|
||||
// UseCases
|
||||
i.addLazySingleton(SignInWithPhoneUseCase.new);
|
||||
@@ -52,10 +53,6 @@ class StaffAuthenticationModule extends Module {
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
void exportedBinds(Injector i) {
|
||||
i.addLazySingleton<AuthRepositoryInterface>(AuthRepositoryImpl.new);
|
||||
}
|
||||
|
||||
@override
|
||||
void routes(RouteManager r) {
|
||||
|
||||
Reference in New Issue
Block a user