feat: Update ownerId assignment in HomeRepositoryImpl and clean up shifts page code

This commit is contained in:
Achintha Isuru
2026-02-18 15:25:31 -05:00
parent cce1b75fc0
commit 535f6ffb1c
4 changed files with 44 additions and 36 deletions

View File

@@ -105,7 +105,7 @@ class HomeRepositoryImpl
address: staff.addres,
avatar: staff.photoUrl,
),
ownerId: session?.ownerId,
ownerId: staff.ownerId,
);
StaffSessionStore.instance.setSession(updatedSession);

View File

@@ -187,8 +187,6 @@ class ShiftsRepositoryImpl
.listShiftRolesByVendorId(vendorId: vendorId)
.execute());
final allShiftRoles = result.data.shiftRoles;
// Fetch my applications to filter out already booked shifts

View File

@@ -175,30 +175,30 @@ class _ShiftsPageState extends State<ShiftsPage> {
child: state is ShiftsLoading
? const Center(child: CircularProgressIndicator())
: state is ShiftsError
? Center(
child: Padding(
padding: const EdgeInsets.all(UiConstants.space5),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Text(
translateErrorKey(state.message),
style: UiTypography.body2r.textSecondary,
textAlign: TextAlign.center,
),
],
? Center(
child: Padding(
padding: const EdgeInsets.all(UiConstants.space5),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Text(
translateErrorKey(state.message),
style: UiTypography.body2r.textSecondary,
textAlign: TextAlign.center,
),
),
)
: _buildTabContent(
],
),
),
)
: _buildTabContent(
myShifts,
pendingAssignments,
cancelledShifts,
availableJobs,
historyShifts,
availableLoading,
historyLoading,
),
pendingAssignments,
cancelledShifts,
availableJobs,
historyShifts,
availableLoading,
historyLoading,
),
),
],
),
@@ -254,14 +254,14 @@ class _ShiftsPageState extends State<ShiftsPage> {
onTap: !enabled
? null
: () {
setState(() => _activeTab = id);
if (id == 'history') {
_bloc.add(LoadHistoryShiftsEvent());
}
if (id == 'find') {
_bloc.add(LoadAvailableShiftsEvent());
}
},
setState(() => _activeTab = id);
if (id == 'history') {
_bloc.add(LoadHistoryShiftsEvent());
}
if (id == 'find') {
_bloc.add(LoadAvailableShiftsEvent());
}
},
child: Container(
padding: const EdgeInsets.symmetric(
vertical: UiConstants.space2,
@@ -290,9 +290,17 @@ class _ShiftsPageState extends State<ShiftsPage> {
Flexible(
child: Text(
label,
style: (isActive ? UiTypography.body3m.copyWith(color: UiColors.primary) : UiTypography.body3m.white).copyWith(
color: !enabled ? UiColors.white.withValues(alpha: 0.5) : null,
),
style:
(isActive
? UiTypography.body3m.copyWith(
color: UiColors.primary,
)
: UiTypography.body3m.white)
.copyWith(
color: !enabled
? UiColors.white.withValues(alpha: 0.5)
: null,
),
overflow: TextOverflow.ellipsis,
),
),

View File

@@ -32,6 +32,8 @@ dependencies:
url_launcher: ^6.3.1
firebase_auth: ^6.1.4
firebase_data_connect: ^0.2.2+2
meta: ^1.17.0
bloc: ^8.1.4
dev_dependencies:
flutter_test: