mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-07-10 07:07:19 +00:00
Success dialog and Failed dialog changes with VisitorPasswordDialog
This commit is contained in:
@ -39,12 +39,9 @@ class AccessBloc extends Bloc<AccessEvent, AccessState> {
|
||||
}
|
||||
}
|
||||
void updateTabsCount() {
|
||||
// Count occurrences based on the type field
|
||||
int toBeEffectiveCount = data.where((item) => item.passwordStatus.value== 'To Be Effective').length;
|
||||
int effectiveCount = data.where((item) => item.passwordStatus.value == 'Effective').length;
|
||||
int expiredCount = data.where((item) => item.passwordStatus.value == 'Expired').length;
|
||||
|
||||
// Update tab labels with counts
|
||||
tabs[1] = 'To Be Effective ($toBeEffectiveCount)';
|
||||
tabs[2] = 'Effective ($effectiveCount)';
|
||||
tabs[3] = 'Expired ($expiredCount)';
|
||||
@ -53,7 +50,6 @@ class AccessBloc extends Bloc<AccessEvent, AccessState> {
|
||||
|
||||
|
||||
int selectedIndex = 0;
|
||||
|
||||
final List<String> tabs = [
|
||||
'All',
|
||||
'To Be Effective (0)',
|
||||
@ -76,7 +72,6 @@ class AccessBloc extends Bloc<AccessEvent, AccessState> {
|
||||
|
||||
|
||||
Future<void> selectTime(SelectTime event, Emitter<AccessState> emit) async {
|
||||
|
||||
final DateTime? picked = await showDatePicker(
|
||||
context: event.context,
|
||||
initialDate: DateTime.now(),
|
||||
@ -146,8 +141,6 @@ class AccessBloc extends Bloc<AccessEvent, AccessState> {
|
||||
try {
|
||||
filteredData = data.where((item) {
|
||||
bool matchesCriteria = true;
|
||||
|
||||
// Filter by password name if provided
|
||||
if (event.passwordName != null && event.passwordName!.isNotEmpty) {
|
||||
final bool matchesName = item.passwordName != null &&
|
||||
item.passwordName.contains(event.passwordName);
|
||||
@ -155,8 +148,6 @@ class AccessBloc extends Bloc<AccessEvent, AccessState> {
|
||||
matchesCriteria = false;
|
||||
}
|
||||
}
|
||||
|
||||
// Filter by date range if provided
|
||||
if (event.startTime != null && event.endTime != null) {
|
||||
final int? effectiveTime = int.tryParse(item.effectiveTime.toString());
|
||||
final int? invalidTime = int.tryParse(item.invalidTime.toString());
|
||||
@ -170,8 +161,6 @@ class AccessBloc extends Bloc<AccessEvent, AccessState> {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Filter by tab selection
|
||||
if (event.selectedTabIndex == 1 && item.passwordStatus.value != 'To Be Effective') {
|
||||
matchesCriteria = false;
|
||||
} else if (event.selectedTabIndex == 2 && item.passwordStatus.value != 'Effective') {
|
||||
@ -179,7 +168,6 @@ class AccessBloc extends Bloc<AccessEvent, AccessState> {
|
||||
} else if (event.selectedTabIndex == 3 && item.passwordStatus.value != 'Expired') {
|
||||
matchesCriteria = false;
|
||||
}
|
||||
|
||||
return matchesCriteria;
|
||||
}).toList();
|
||||
emit(TableLoaded(filteredData));
|
||||
@ -206,7 +194,6 @@ class AccessBloc extends Bloc<AccessEvent, AccessState> {
|
||||
try {
|
||||
emit(AccessLoaded());
|
||||
selectedIndex = event.selectedIndex;
|
||||
// Apply filtering based on selected tab
|
||||
switch (selectedIndex) {
|
||||
case 0: // All
|
||||
filteredData = data;
|
||||
@ -216,7 +203,6 @@ class AccessBloc extends Bloc<AccessEvent, AccessState> {
|
||||
break;
|
||||
case 2: // Effective
|
||||
filteredData = data.where((item) => item.passwordStatus.value == "Effective").toList();
|
||||
|
||||
break;
|
||||
case 3: // Expired
|
||||
filteredData = data.where((item) => item.passwordStatus.value == "Expired").toList();
|
||||
@ -225,7 +211,7 @@ class AccessBloc extends Bloc<AccessEvent, AccessState> {
|
||||
filteredData = data;
|
||||
}
|
||||
add(FilterDataEvent(
|
||||
selectedTabIndex: selectedIndex, // Pass the selected tab index
|
||||
selectedTabIndex: selectedIndex,
|
||||
passwordName: passwordName.text.toLowerCase(),
|
||||
startTime: effectiveTimeTimeStamp,
|
||||
endTime: expirationTimeTimeStamp
|
||||
|
@ -21,17 +21,14 @@ class AccessManagementPage extends StatelessWidget {
|
||||
enableMenuSideba: false,
|
||||
appBarTitle: Row(
|
||||
children: [
|
||||
Text(
|
||||
'Access Management',
|
||||
Text('Access Management',
|
||||
style: Theme.of(context).textTheme.headlineLarge,
|
||||
)
|
||||
],
|
||||
),
|
||||
appBarBody: [
|
||||
Text(
|
||||
'Physical Access',
|
||||
style: Theme.of(context)
|
||||
.textTheme
|
||||
Text('Physical Access',
|
||||
style: Theme.of(context).textTheme
|
||||
.headlineMedium!
|
||||
.copyWith(color: Colors.white),
|
||||
),
|
||||
@ -101,7 +98,9 @@ class AccessManagementPage extends StatelessWidget {
|
||||
height: 20,
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
textBaseline: TextBaseline.ideographic, children: [
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
@ -111,7 +110,7 @@ class AccessManagementPage extends StatelessWidget {
|
||||
color: Colors.black,fontSize: 13),),
|
||||
const SizedBox(height: 5,),
|
||||
Container(
|
||||
height:size.height * 0.053,
|
||||
height:43,
|
||||
width: size.width * 0.15,
|
||||
decoration: containerDecoration,
|
||||
child: TextFormField(
|
||||
@ -145,51 +144,44 @@ class AccessManagementPage extends StatelessWidget {
|
||||
),
|
||||
|
||||
SizedBox(
|
||||
height:45,
|
||||
|
||||
width: size.width * 0.06,
|
||||
child: Column(
|
||||
children: [
|
||||
Text(''),
|
||||
Container(
|
||||
decoration: containerDecoration,
|
||||
child: DefaultButton(
|
||||
onPressed: () {
|
||||
accessBloc.add(FilterDataEvent(
|
||||
selectedTabIndex: BlocProvider.of<AccessBloc>(context).selectedIndex, // Pass the selected tab index
|
||||
passwordName: accessBloc.passwordName.text.toLowerCase(),
|
||||
startTime: accessBloc.effectiveTimeTimeStamp,
|
||||
endTime: accessBloc.expirationTimeTimeStamp
|
||||
));
|
||||
}, borderRadius: 9,
|
||||
child: const Text('Search'))),
|
||||
],
|
||||
),
|
||||
child:Container(
|
||||
decoration: containerDecoration,
|
||||
child: DefaultButton(
|
||||
onPressed: () {
|
||||
accessBloc.add(FilterDataEvent(
|
||||
selectedTabIndex: BlocProvider.of<AccessBloc>(context).selectedIndex, // Pass the selected tab index
|
||||
passwordName: accessBloc.passwordName.text.toLowerCase(),
|
||||
startTime: accessBloc.effectiveTimeTimeStamp,
|
||||
endTime: accessBloc.expirationTimeTimeStamp
|
||||
));
|
||||
}, borderRadius: 9,
|
||||
child: const Text('Search'))),
|
||||
),
|
||||
const SizedBox(
|
||||
width: 10,
|
||||
),
|
||||
SizedBox(
|
||||
height:45,
|
||||
width: size.width * 0.06,
|
||||
child: Column(
|
||||
children: [
|
||||
Text(''),
|
||||
Container(
|
||||
decoration: containerDecoration,
|
||||
child: DefaultButton(
|
||||
onPressed: () {
|
||||
accessBloc.add(ResetSearch());
|
||||
},
|
||||
backgroundColor: ColorsManager.whiteColors,
|
||||
borderRadius: 9,
|
||||
child: Text(
|
||||
'Reset',
|
||||
style: Theme.of(context)
|
||||
.textTheme
|
||||
.bodySmall!
|
||||
.copyWith(color: Colors.black),
|
||||
),
|
||||
),
|
||||
child: Container(
|
||||
decoration: containerDecoration,
|
||||
child: DefaultButton(
|
||||
onPressed: () {
|
||||
accessBloc.add(ResetSearch());
|
||||
},
|
||||
backgroundColor: ColorsManager.whiteColors,
|
||||
borderRadius: 9,
|
||||
child: Text(
|
||||
'Reset',
|
||||
style: Theme.of(context)
|
||||
.textTheme
|
||||
.bodySmall!
|
||||
.copyWith(color: Colors.black),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
|
Reference in New Issue
Block a user