fixing bug of count my shift
This commit is contained in:
@@ -63,6 +63,7 @@ class ShiftsBloc extends Bloc<ShiftsEvent, ShiftsState> {
|
|||||||
availableLoaded: false,
|
availableLoaded: false,
|
||||||
historyLoading: false,
|
historyLoading: false,
|
||||||
historyLoaded: false,
|
historyLoaded: false,
|
||||||
|
myShiftsLoaded: true,
|
||||||
searchQuery: '',
|
searchQuery: '',
|
||||||
jobType: 'all',
|
jobType: 'all',
|
||||||
));
|
));
|
||||||
@@ -83,6 +84,7 @@ class ShiftsBloc extends Bloc<ShiftsEvent, ShiftsState> {
|
|||||||
try {
|
try {
|
||||||
final historyResult = await getHistoryShifts();
|
final historyResult = await getHistoryShifts();
|
||||||
emit(currentState.copyWith(
|
emit(currentState.copyWith(
|
||||||
|
myShiftsLoaded: true,
|
||||||
historyShifts: historyResult,
|
historyShifts: historyResult,
|
||||||
historyLoading: false,
|
historyLoading: false,
|
||||||
historyLoaded: true,
|
historyLoaded: true,
|
||||||
@@ -129,6 +131,7 @@ class ShiftsBloc extends Bloc<ShiftsEvent, ShiftsState> {
|
|||||||
availableLoaded: false,
|
availableLoaded: false,
|
||||||
historyLoading: false,
|
historyLoading: false,
|
||||||
historyLoaded: false,
|
historyLoaded: false,
|
||||||
|
myShiftsLoaded: false,
|
||||||
searchQuery: '',
|
searchQuery: '',
|
||||||
jobType: 'all',
|
jobType: 'all',
|
||||||
));
|
));
|
||||||
@@ -157,6 +160,7 @@ class ShiftsBloc extends Bloc<ShiftsEvent, ShiftsState> {
|
|||||||
availableLoaded: false,
|
availableLoaded: false,
|
||||||
historyLoading: false,
|
historyLoading: false,
|
||||||
historyLoaded: false,
|
historyLoaded: false,
|
||||||
|
myShiftsLoaded: false,
|
||||||
searchQuery: '',
|
searchQuery: '',
|
||||||
jobType: 'all',
|
jobType: 'all',
|
||||||
);
|
);
|
||||||
@@ -184,7 +188,10 @@ class ShiftsBloc extends Bloc<ShiftsEvent, ShiftsState> {
|
|||||||
|
|
||||||
if (state is ShiftsLoaded) {
|
if (state is ShiftsLoaded) {
|
||||||
final currentState = state as ShiftsLoaded;
|
final currentState = state as ShiftsLoaded;
|
||||||
emit(currentState.copyWith(myShifts: myShiftsResult));
|
emit(currentState.copyWith(
|
||||||
|
myShifts: myShiftsResult,
|
||||||
|
myShiftsLoaded: true,
|
||||||
|
));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -198,6 +205,7 @@ class ShiftsBloc extends Bloc<ShiftsEvent, ShiftsState> {
|
|||||||
availableLoaded: false,
|
availableLoaded: false,
|
||||||
historyLoading: false,
|
historyLoading: false,
|
||||||
historyLoaded: false,
|
historyLoaded: false,
|
||||||
|
myShiftsLoaded: true,
|
||||||
searchQuery: '',
|
searchQuery: '',
|
||||||
jobType: 'all',
|
jobType: 'all',
|
||||||
));
|
));
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ class ShiftsLoaded extends ShiftsState {
|
|||||||
final bool availableLoaded;
|
final bool availableLoaded;
|
||||||
final bool historyLoading;
|
final bool historyLoading;
|
||||||
final bool historyLoaded;
|
final bool historyLoaded;
|
||||||
|
final bool myShiftsLoaded;
|
||||||
final String searchQuery;
|
final String searchQuery;
|
||||||
final String jobType;
|
final String jobType;
|
||||||
|
|
||||||
@@ -35,6 +36,7 @@ class ShiftsLoaded extends ShiftsState {
|
|||||||
required this.availableLoaded,
|
required this.availableLoaded,
|
||||||
required this.historyLoading,
|
required this.historyLoading,
|
||||||
required this.historyLoaded,
|
required this.historyLoaded,
|
||||||
|
required this.myShiftsLoaded,
|
||||||
required this.searchQuery,
|
required this.searchQuery,
|
||||||
required this.jobType,
|
required this.jobType,
|
||||||
});
|
});
|
||||||
@@ -49,6 +51,7 @@ class ShiftsLoaded extends ShiftsState {
|
|||||||
bool? availableLoaded,
|
bool? availableLoaded,
|
||||||
bool? historyLoading,
|
bool? historyLoading,
|
||||||
bool? historyLoaded,
|
bool? historyLoaded,
|
||||||
|
bool? myShiftsLoaded,
|
||||||
String? searchQuery,
|
String? searchQuery,
|
||||||
String? jobType,
|
String? jobType,
|
||||||
}) {
|
}) {
|
||||||
@@ -62,6 +65,7 @@ class ShiftsLoaded extends ShiftsState {
|
|||||||
availableLoaded: availableLoaded ?? this.availableLoaded,
|
availableLoaded: availableLoaded ?? this.availableLoaded,
|
||||||
historyLoading: historyLoading ?? this.historyLoading,
|
historyLoading: historyLoading ?? this.historyLoading,
|
||||||
historyLoaded: historyLoaded ?? this.historyLoaded,
|
historyLoaded: historyLoaded ?? this.historyLoaded,
|
||||||
|
myShiftsLoaded: myShiftsLoaded ?? this.myShiftsLoaded,
|
||||||
searchQuery: searchQuery ?? this.searchQuery,
|
searchQuery: searchQuery ?? this.searchQuery,
|
||||||
jobType: jobType ?? this.jobType,
|
jobType: jobType ?? this.jobType,
|
||||||
);
|
);
|
||||||
@@ -78,6 +82,7 @@ class ShiftsLoaded extends ShiftsState {
|
|||||||
availableLoaded,
|
availableLoaded,
|
||||||
historyLoading,
|
historyLoading,
|
||||||
historyLoaded,
|
historyLoaded,
|
||||||
|
myShiftsLoaded,
|
||||||
searchQuery,
|
searchQuery,
|
||||||
jobType,
|
jobType,
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -98,6 +98,9 @@ class _ShiftsPageState extends State<ShiftsPage> {
|
|||||||
final bool historyLoaded = (state is ShiftsLoaded)
|
final bool historyLoaded = (state is ShiftsLoaded)
|
||||||
? state.historyLoaded
|
? state.historyLoaded
|
||||||
: false;
|
: false;
|
||||||
|
final bool myShiftsLoaded = (state is ShiftsLoaded)
|
||||||
|
? state.myShiftsLoaded
|
||||||
|
: false;
|
||||||
final bool blockTabsForFind = _prioritizeFind && !availableLoaded;
|
final bool blockTabsForFind = _prioritizeFind && !availableLoaded;
|
||||||
|
|
||||||
// Note: "filteredJobs" logic moved to FindShiftsTab
|
// Note: "filteredJobs" logic moved to FindShiftsTab
|
||||||
@@ -137,6 +140,7 @@ class _ShiftsPageState extends State<ShiftsPage> {
|
|||||||
"My Shifts",
|
"My Shifts",
|
||||||
UiIcons.calendar,
|
UiIcons.calendar,
|
||||||
myShifts.length,
|
myShifts.length,
|
||||||
|
showCount: myShiftsLoaded,
|
||||||
enabled: !blockTabsForFind,
|
enabled: !blockTabsForFind,
|
||||||
),
|
),
|
||||||
const SizedBox(width: 8),
|
const SizedBox(width: 8),
|
||||||
|
|||||||
Reference in New Issue
Block a user