mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-07-16 18:16:34 +00:00
Compare commits
1 Commits
sp_462
...
web_change
Author | SHA1 | Date | |
---|---|---|---|
6b2e0b1ce5 |
@ -3,27 +3,25 @@ import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:syncrow_web/pages/access_management/bloc/access_event.dart';
|
||||
import 'package:syncrow_web/pages/access_management/bloc/access_state.dart';
|
||||
import 'package:syncrow_web/pages/access_management/model/password_model.dart';
|
||||
import 'package:syncrow_web/pages/common/hour_picker_dialog.dart';
|
||||
import 'package:syncrow_web/services/access_mang_api.dart';
|
||||
import 'package:syncrow_web/utils/color_manager.dart';
|
||||
import 'package:syncrow_web/utils/constants/app_enum.dart';
|
||||
import 'package:syncrow_web/utils/snack_bar.dart';
|
||||
|
||||
class AccessBloc extends Bloc<AccessEvent, AccessState> {
|
||||
AccessBloc() : super((AccessInitial())) {
|
||||
on<FetchTableData>(_onFetchTableData);
|
||||
// on<TabChangedEvent>(selectFilterTap);
|
||||
on<SelectTime>(selectTime);
|
||||
on<FilterDataEvent>(_filterData);
|
||||
on<ResetSearch>(resetSearch);
|
||||
on<TabChangedEvent>(onTabChanged);
|
||||
}
|
||||
|
||||
String startTime = 'Start Date';
|
||||
String endTime = 'End Date';
|
||||
|
||||
int? effectiveTimeTimeStamp;
|
||||
int? expirationTimeTimeStamp;
|
||||
TextEditingController passwordName = TextEditingController();
|
||||
TextEditingController emailAuthorizer = TextEditingController();
|
||||
List<PasswordModel> filteredData = [];
|
||||
List<PasswordModel> data = [];
|
||||
|
||||
@ -64,61 +62,57 @@ class AccessBloc extends Bloc<AccessEvent, AccessState> {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Future<void> selectTime(SelectTime event, Emitter<AccessState> emit,) async {
|
||||
Future<void> selectTime(SelectTime event, Emitter<AccessState> emit) async {
|
||||
emit(AccessLoaded());
|
||||
final DateTime? picked = await showDatePicker(
|
||||
context: event.context,
|
||||
initialDate: DateTime.now(),
|
||||
firstDate: DateTime.now().add(const Duration(days: -5095)),
|
||||
lastDate: DateTime.now().add(const Duration(days: 2095)),
|
||||
firstDate: DateTime(2015, 8),
|
||||
lastDate: DateTime(2101),
|
||||
);
|
||||
if (picked != null) {
|
||||
final TimeOfDay? timePicked = await showHourPicker(
|
||||
context: event.context,
|
||||
initialTime: TimeOfDay.now(),
|
||||
);
|
||||
|
||||
if (timePicked != null) {
|
||||
final DateTime selectedDateTime = DateTime(
|
||||
final selectedDateTime = DateTime(
|
||||
picked.year,
|
||||
picked.month,
|
||||
picked.day,
|
||||
timePicked.hour,
|
||||
timePicked.minute,
|
||||
);
|
||||
final int selectedTimestamp = selectedDateTime.millisecondsSinceEpoch ~/ 1000;
|
||||
final selectedTimestamp = DateTime(
|
||||
selectedDateTime.year,
|
||||
selectedDateTime.month,
|
||||
selectedDateTime.day,
|
||||
selectedDateTime.hour,
|
||||
selectedDateTime.minute,
|
||||
).millisecondsSinceEpoch ~/
|
||||
1000; // Divide by 1000 to remove milliseconds
|
||||
if (event.isStart) {
|
||||
if (expirationTimeTimeStamp != null && selectedTimestamp > expirationTimeTimeStamp!) {
|
||||
CustomSnackBar.displaySnackBar('Effective Time cannot be later than Expiration Time.');
|
||||
} else {
|
||||
startTime = selectedDateTime.toString().split('.').first;
|
||||
startTime =
|
||||
selectedDateTime.toString().split('.').first; // Remove seconds and milliseconds
|
||||
effectiveTimeTimeStamp = selectedTimestamp;
|
||||
}
|
||||
} else {
|
||||
if (effectiveTimeTimeStamp != null && selectedTimestamp < effectiveTimeTimeStamp!) {
|
||||
CustomSnackBar.displaySnackBar('Expiration Time cannot be earlier than Effective Time.');
|
||||
} else {
|
||||
endTime = selectedDateTime.toString().split('.').first;
|
||||
endTime = selectedDateTime.toString().split('.').first; // Remove seconds and milliseconds
|
||||
expirationTimeTimeStamp = selectedTimestamp;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
emit(ChangeTimeState());
|
||||
|
||||
}
|
||||
|
||||
|
||||
Future<void> _filterData(FilterDataEvent event, Emitter<AccessState> emit) async {
|
||||
emit(AccessLoaded());
|
||||
try {
|
||||
print(event.emailAuthorizer?.toLowerCase());
|
||||
// Convert search text to lower case for case-insensitive search
|
||||
final searchText = event.passwordName?.toLowerCase() ?? '';
|
||||
final searchEmailText = event.emailAuthorizer?.toLowerCase() ?? '';
|
||||
|
||||
filteredData = data.where((item) {
|
||||
bool matchesCriteria = true;
|
||||
|
||||
// Convert timestamp to DateTime and extract date component
|
||||
DateTime effectiveDate =
|
||||
DateTime.fromMillisecondsSinceEpoch(int.parse(item.effectiveTime.toString()) * 1000)
|
||||
@ -128,8 +122,9 @@ class AccessBloc extends Bloc<AccessEvent, AccessState> {
|
||||
DateTime.fromMillisecondsSinceEpoch(int.parse(item.invalidTime.toString()) * 1000)
|
||||
.toUtc()
|
||||
.toLocal();
|
||||
DateTime effectiveDateAndTime = DateTime(effectiveDate.year, effectiveDate.month, effectiveDate.day,effectiveDate.hour,effectiveDate.minute);
|
||||
DateTime invalidDateAndTime = DateTime(invalidDate.year, invalidDate.month, invalidDate.day,invalidDate.hour,invalidDate.minute);
|
||||
DateTime effectiveDateOnly =
|
||||
DateTime(effectiveDate.year, effectiveDate.month, effectiveDate.day);
|
||||
DateTime invalidDateOnly = DateTime(invalidDate.year, invalidDate.month, invalidDate.day);
|
||||
|
||||
// Filter by password name, making the search case-insensitive
|
||||
if (searchText.isNotEmpty) {
|
||||
@ -138,51 +133,36 @@ class AccessBloc extends Bloc<AccessEvent, AccessState> {
|
||||
matchesCriteria = false;
|
||||
}
|
||||
}
|
||||
if (searchEmailText.isNotEmpty) {
|
||||
final bool matchesName = item.authorizerEmail.toString().toLowerCase().contains(searchEmailText);
|
||||
if (!matchesName) {
|
||||
matchesCriteria = false;
|
||||
}
|
||||
}
|
||||
|
||||
// Filter by start date only
|
||||
if (event.startTime != null && event.endTime == null) {
|
||||
DateTime startDateTime =
|
||||
DateTime startDateOnly =
|
||||
DateTime.fromMillisecondsSinceEpoch(event.startTime! * 1000).toUtc().toLocal();
|
||||
startDateTime = DateTime(
|
||||
startDateTime.year,
|
||||
startDateTime.month,
|
||||
startDateTime.day,
|
||||
startDateTime.hour,
|
||||
startDateTime.minute);
|
||||
if (effectiveDateAndTime.isBefore(startDateTime)) {
|
||||
startDateOnly = DateTime(startDateOnly.year, startDateOnly.month, startDateOnly.day);
|
||||
if (effectiveDateOnly.isBefore(startDateOnly)) {
|
||||
matchesCriteria = false;
|
||||
}
|
||||
}
|
||||
|
||||
// Filter by end date only
|
||||
if (event.endTime != null && event.startTime == null) {
|
||||
DateTime startDateTime =
|
||||
DateTime endDateOnly =
|
||||
DateTime.fromMillisecondsSinceEpoch(event.endTime! * 1000).toUtc().toLocal();
|
||||
startDateTime = DateTime(
|
||||
startDateTime.year,
|
||||
startDateTime.month,
|
||||
startDateTime.day,
|
||||
startDateTime.hour,
|
||||
startDateTime.minute
|
||||
);
|
||||
if (invalidDateAndTime.isAfter(startDateTime)) {
|
||||
endDateOnly = DateTime(endDateOnly.year, endDateOnly.month, endDateOnly.day);
|
||||
if (invalidDateOnly.isAfter(endDateOnly)) {
|
||||
matchesCriteria = false;
|
||||
}
|
||||
}
|
||||
|
||||
// Filter by both start date and end date
|
||||
if (event.startTime != null && event.endTime != null) {
|
||||
DateTime startDateTime =
|
||||
DateTime startDateOnly =
|
||||
DateTime.fromMillisecondsSinceEpoch(event.startTime! * 1000).toUtc().toLocal();
|
||||
DateTime endDateTime =
|
||||
DateTime endDateOnly =
|
||||
DateTime.fromMillisecondsSinceEpoch(event.endTime! * 1000).toUtc().toLocal();
|
||||
startDateTime = DateTime(startDateTime.year, startDateTime.month, startDateTime.day,startDateTime.hour,startDateTime.minute);
|
||||
endDateTime = DateTime(endDateTime.year, endDateTime.month, endDateTime.day,endDateTime.hour,endDateTime.minute);
|
||||
if (effectiveDateAndTime.isBefore(startDateTime) || invalidDateAndTime.isAfter(endDateTime)) {
|
||||
startDateOnly = DateTime(startDateOnly.year, startDateOnly.month, startDateOnly.day);
|
||||
endDateOnly = DateTime(endDateOnly.year, endDateOnly.month, endDateOnly.day);
|
||||
if (effectiveDateOnly.isBefore(startDateOnly) || invalidDateOnly.isAfter(endDateOnly)) {
|
||||
matchesCriteria = false;
|
||||
}
|
||||
}
|
||||
@ -206,12 +186,12 @@ class AccessBloc extends Bloc<AccessEvent, AccessState> {
|
||||
}
|
||||
|
||||
|
||||
|
||||
resetSearch(ResetSearch event, Emitter<AccessState> emit) async {
|
||||
emit(AccessLoaded());
|
||||
startTime = 'Start Time';
|
||||
endTime = 'End Time';
|
||||
passwordName.clear();
|
||||
emailAuthorizer.clear();
|
||||
selectedIndex = 0;
|
||||
effectiveTimeTimeStamp = null;
|
||||
expirationTimeTimeStamp = null;
|
||||
@ -220,11 +200,9 @@ class AccessBloc extends Bloc<AccessEvent, AccessState> {
|
||||
|
||||
String timestampToDate(dynamic timestamp) {
|
||||
DateTime dateTime = DateTime.fromMillisecondsSinceEpoch(int.parse(timestamp) * 1000);
|
||||
return "${dateTime.year}/${dateTime.month.toString().padLeft(2, '0')}/${dateTime.day.toString().padLeft(2, '0')} "
|
||||
" ${dateTime.hour.toString().padLeft(2, '0')}:${dateTime.minute.toString().padLeft(2, '0')}";
|
||||
return "${dateTime.year}/${dateTime.month.toString().padLeft(2, '0')}/${dateTime.day.toString().padLeft(2, '0')}";
|
||||
}
|
||||
|
||||
|
||||
Future<void> onTabChanged(TabChangedEvent event, Emitter<AccessState> emit) async {
|
||||
try {
|
||||
emit(AccessLoaded());
|
||||
@ -249,7 +227,6 @@ class AccessBloc extends Bloc<AccessEvent, AccessState> {
|
||||
add(FilterDataEvent(
|
||||
selectedTabIndex: selectedIndex,
|
||||
passwordName: passwordName.text.toLowerCase(),
|
||||
emailAuthorizer: emailAuthorizer.text.toLowerCase(),
|
||||
startTime: effectiveTimeTimeStamp,
|
||||
endTime: expirationTimeTimeStamp));
|
||||
emit(TableLoaded(filteredData));
|
||||
@ -257,6 +234,4 @@ class AccessBloc extends Bloc<AccessEvent, AccessState> {
|
||||
emit(FailedState(e.toString()));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -28,14 +28,12 @@ class SelectTime extends AccessEvent {
|
||||
|
||||
class FilterDataEvent extends AccessEvent {
|
||||
final String? passwordName;
|
||||
final String? emailAuthorizer;
|
||||
final int? startTime;
|
||||
final int? endTime;
|
||||
final int selectedTabIndex; // Add this field
|
||||
|
||||
const FilterDataEvent({
|
||||
this.passwordName,
|
||||
this.emailAuthorizer,
|
||||
this.startTime,
|
||||
this.endTime,
|
||||
required this.selectedTabIndex, // Initialize this field
|
||||
|
@ -6,13 +6,10 @@ class PasswordModel {
|
||||
final dynamic effectiveTime;
|
||||
final dynamic passwordCreated;
|
||||
final dynamic createdTime;
|
||||
final dynamic passwordName;
|
||||
final dynamic passwordName; // New field
|
||||
final AccessStatus passwordStatus;
|
||||
final AccessType passwordType;
|
||||
final dynamic deviceUuid;
|
||||
final dynamic authorizerEmail;
|
||||
final dynamic authorizerDate;
|
||||
final dynamic deviceName;
|
||||
|
||||
PasswordModel({
|
||||
this.passwordId,
|
||||
@ -20,13 +17,10 @@ class PasswordModel {
|
||||
this.effectiveTime,
|
||||
this.passwordCreated,
|
||||
this.createdTime,
|
||||
this.passwordName,
|
||||
this.passwordName, // New field
|
||||
required this.passwordStatus,
|
||||
required this.passwordType,
|
||||
this.deviceUuid,
|
||||
this.authorizerEmail,
|
||||
this.authorizerDate,
|
||||
this.deviceName,
|
||||
});
|
||||
|
||||
factory PasswordModel.fromJson(Map<String, dynamic> json) {
|
||||
@ -40,9 +34,6 @@ class PasswordModel {
|
||||
passwordStatus: AccessStatusExtension.fromString(json['passwordStatus']),
|
||||
passwordType: AccessTypeExtension.fromString(json['passwordType']),
|
||||
deviceUuid: json['deviceUuid'],
|
||||
authorizerEmail: json['authorizerEmail'],
|
||||
authorizerDate: json['authorizerDate'],
|
||||
deviceName: json['deviceName'],
|
||||
);
|
||||
}
|
||||
|
||||
@ -53,13 +44,10 @@ class PasswordModel {
|
||||
'effectiveTime': effectiveTime,
|
||||
'passwordCreated': passwordCreated,
|
||||
'createdTime': createdTime,
|
||||
'passwordName': passwordName, // New field
|
||||
'passwodName': passwordName, // New field
|
||||
'passwordStatus': passwordStatus,
|
||||
'passwordType': passwordType,
|
||||
'deviceUuid': deviceUuid,
|
||||
'authorizerEmail': authorizerEmail,
|
||||
'authorizerDate': authorizerDate,
|
||||
'deviceName': deviceName,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -24,7 +24,6 @@ class AccessManagementPage extends StatelessWidget with HelperResponsiveLayout {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
||||
final isLargeScreen = isLargeScreenSize(context);
|
||||
final isSmallScreen = isSmallScreenSize(context);
|
||||
final isHalfMediumScreen = isHafMediumScreenSize(context);
|
||||
@ -97,8 +96,7 @@ class AccessManagementPage extends StatelessWidget with HelperResponsiveLayout {
|
||||
headers: const [
|
||||
'Name',
|
||||
'Access Type',
|
||||
'Access Start',
|
||||
'Access End',
|
||||
'Access Period',
|
||||
'Accessible Device',
|
||||
'Authorizer',
|
||||
'Authorization Date & Time',
|
||||
@ -108,11 +106,10 @@ class AccessManagementPage extends StatelessWidget with HelperResponsiveLayout {
|
||||
return [
|
||||
item.passwordName,
|
||||
item.passwordType.value,
|
||||
accessBloc.timestampToDate(item.effectiveTime),
|
||||
accessBloc.timestampToDate(item.invalidTime),
|
||||
item.deviceName.toString(),
|
||||
item.authorizerEmail.toString(),
|
||||
accessBloc.timestampToDate(item.invalidTime),
|
||||
('${accessBloc.timestampToDate(item.effectiveTime)} - ${accessBloc.timestampToDate(item.invalidTime)}'),
|
||||
item.deviceUuid.toString(),
|
||||
'',
|
||||
'',
|
||||
item.passwordStatus.value,
|
||||
];
|
||||
}).toList(),
|
||||
@ -169,8 +166,6 @@ class AccessManagementPage extends StatelessWidget with HelperResponsiveLayout {
|
||||
}
|
||||
|
||||
Row _buildNormalSearchWidgets(BuildContext context, AccessBloc accessBloc) {
|
||||
TimeOfDay _selectedTime = TimeOfDay.now();
|
||||
|
||||
return Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
@ -187,17 +182,6 @@ class AccessManagementPage extends StatelessWidget with HelperResponsiveLayout {
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 15),
|
||||
SizedBox(
|
||||
width: 250,
|
||||
child: CustomWebTextField(
|
||||
controller: accessBloc.emailAuthorizer,
|
||||
height: 43,
|
||||
isRequired: false,
|
||||
textFieldName: 'Authorizer',
|
||||
description: '',
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 15),
|
||||
SizedBox(
|
||||
child: DateTimeWebWidget(
|
||||
icon: Assets.calendarIcon,
|
||||
@ -218,7 +202,6 @@ class AccessManagementPage extends StatelessWidget with HelperResponsiveLayout {
|
||||
SearchResetButtons(
|
||||
onSearch: () {
|
||||
accessBloc.add(FilterDataEvent(
|
||||
emailAuthorizer:accessBloc.emailAuthorizer.text.toLowerCase() ,
|
||||
selectedTabIndex: BlocProvider.of<AccessBloc>(context).selectedIndex,
|
||||
passwordName: accessBloc.passwordName.text.toLowerCase(),
|
||||
startTime: accessBloc.effectiveTimeTimeStamp,
|
||||
@ -264,12 +247,10 @@ class AccessManagementPage extends StatelessWidget with HelperResponsiveLayout {
|
||||
SearchResetButtons(
|
||||
onSearch: () {
|
||||
accessBloc.add(FilterDataEvent(
|
||||
emailAuthorizer:accessBloc.emailAuthorizer.text.toLowerCase() ,
|
||||
selectedTabIndex: BlocProvider.of<AccessBloc>(context).selectedIndex,
|
||||
passwordName: accessBloc.passwordName.text.toLowerCase(),
|
||||
startTime: accessBloc.effectiveTimeTimeStamp,
|
||||
endTime: accessBloc.expirationTimeTimeStamp
|
||||
));
|
||||
endTime: accessBloc.expirationTimeTimeStamp));
|
||||
},
|
||||
onReset: () {
|
||||
accessBloc.add(ResetSearch());
|
||||
@ -278,6 +259,4 @@ class AccessManagementPage extends StatelessWidget with HelperResponsiveLayout {
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -139,11 +139,9 @@ class ForgetPasswordWebPage extends StatelessWidget {
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
const SizedBox(height: 10),
|
||||
Form(
|
||||
key: forgetBloc.forgetRegionKey,
|
||||
child: SizedBox(
|
||||
SizedBox(
|
||||
child: _buildDropdownField(
|
||||
context, forgetBloc, size)))
|
||||
context, forgetBloc, size))
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
@ -209,23 +207,31 @@ class ForgetPasswordWebPage extends StatelessWidget {
|
||||
decoration:
|
||||
textBoxDecoration()!.copyWith(
|
||||
hintText: 'Enter Code',
|
||||
hintStyle: Theme.of(context).textTheme
|
||||
.bodySmall!.copyWith(
|
||||
color: ColorsManager.grayColor,
|
||||
fontWeight: FontWeight.w400),
|
||||
hintStyle: Theme.of(context)
|
||||
.textTheme
|
||||
.bodySmall!
|
||||
.copyWith(
|
||||
color:
|
||||
ColorsManager.grayColor,
|
||||
fontWeight:
|
||||
FontWeight.w400),
|
||||
suffixIcon: SizedBox(
|
||||
width: 100,
|
||||
child: Center(
|
||||
child: InkWell(
|
||||
onTap: state is TimerState &&
|
||||
!state.isButtonEnabled &&
|
||||
state.remainingTime != 1
|
||||
!state
|
||||
.isButtonEnabled &&
|
||||
state.remainingTime !=
|
||||
1
|
||||
? null
|
||||
: () {
|
||||
if (forgetBloc.forgetEmailKey.currentState!.validate()||forgetBloc.forgetRegionKey.currentState!.validate()) {
|
||||
if(forgetBloc.forgetRegionKey.currentState!.validate()){
|
||||
forgetBloc.add(StartTimerEvent());
|
||||
}
|
||||
if (forgetBloc
|
||||
.forgetEmailKey
|
||||
.currentState!
|
||||
.validate()) {
|
||||
forgetBloc.add(
|
||||
StartTimerEvent());
|
||||
}
|
||||
},
|
||||
child: Text(
|
||||
@ -422,7 +428,7 @@ class ForgetPasswordWebPage extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
SizedBox(
|
||||
Container(
|
||||
width: size.width * 0.9,
|
||||
child: FormField<String>(
|
||||
validator: (value) {
|
||||
@ -487,10 +493,7 @@ class ForgetPasswordWebPage extends StatelessWidget {
|
||||
return DropdownMenuItem<String>(
|
||||
value: region.id,
|
||||
child: Text(
|
||||
style: Theme.of(context).textTheme.bodyMedium!.copyWith(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w400,
|
||||
),
|
||||
style: Theme.of(context).textTheme.bodyMedium,
|
||||
region.name,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
maxLines: 1,
|
||||
@ -565,5 +568,4 @@ class ForgetPasswordWebPage extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -10,7 +10,7 @@ class HourPickerDialog extends StatefulWidget {
|
||||
|
||||
class _HourPickerDialogState extends State<HourPickerDialog> {
|
||||
late int _selectedHour;
|
||||
bool _isPm = false;
|
||||
bool _isPm = true;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
@ -18,7 +18,7 @@ class _HourPickerDialogState extends State<HourPickerDialog> {
|
||||
_selectedHour = widget.initialTime.hour > 12
|
||||
? widget.initialTime.hour - 12
|
||||
: widget.initialTime.hour;
|
||||
_isPm = widget.initialTime.period == DayPeriod.pm;
|
||||
_isPm = widget.initialTime.period == DayPeriod.am;
|
||||
}
|
||||
|
||||
@override
|
||||
@ -48,11 +48,11 @@ class _HourPickerDialogState extends State<HourPickerDialog> {
|
||||
value: _isPm,
|
||||
items: const [
|
||||
DropdownMenuItem(
|
||||
value: false,
|
||||
value: true,
|
||||
child: Text('AM'),
|
||||
),
|
||||
DropdownMenuItem(
|
||||
value: true,
|
||||
value:false ,
|
||||
child: Text('PM'),
|
||||
),
|
||||
],
|
||||
|
@ -116,7 +116,7 @@ class DeviceManagementBody extends StatelessWidget with HelperResponsiveLayout {
|
||||
? const EdgeInsets.all(30)
|
||||
: const EdgeInsets.all(15),
|
||||
child: DynamicTable(
|
||||
withSelectAll: false,
|
||||
withSelectAll: true,
|
||||
cellDecoration: containerDecoration,
|
||||
onRowSelected: (index, isSelected, row) {
|
||||
final selectedDevice = devicesToShow[index];
|
||||
|
@ -75,12 +75,13 @@ class VisitorPasswordBloc extends Bloc<VisitorPasswordEvent, VisitorPasswordStat
|
||||
|
||||
Future<void> selectTimeVisitorPassword(
|
||||
SelectTimeVisitorPassword event,
|
||||
Emitter<VisitorPasswordState> emit,) async {
|
||||
Emitter<VisitorPasswordState> emit,
|
||||
) async {
|
||||
final DateTime? picked = await showDatePicker(
|
||||
context: event.context,
|
||||
initialDate: DateTime.now(),
|
||||
firstDate: DateTime(2015, 8),
|
||||
lastDate: DateTime.now().add(const Duration(days: 5095)),
|
||||
lastDate: DateTime(3101),
|
||||
);
|
||||
|
||||
if (picked != null) {
|
||||
@ -351,15 +352,13 @@ class VisitorPasswordBloc extends Bloc<VisitorPasswordEvent, VisitorPasswordStat
|
||||
context: event.context,
|
||||
initialDate: DateTime.now(),
|
||||
firstDate: DateTime.now(),
|
||||
lastDate: DateTime.now().add(const Duration(days: 2095)),
|
||||
lastDate: DateTime(3101),
|
||||
);
|
||||
if (picked != null) {
|
||||
final TimeOfDay? timePicked = await showHourPicker(
|
||||
context: event.context,
|
||||
initialTime: TimeOfDay.now(),
|
||||
);
|
||||
print('timePicked=$timePicked');
|
||||
|
||||
if (timePicked != null) {
|
||||
final selectedDateTime = DateTime(
|
||||
picked.year,
|
||||
|
@ -12,7 +12,6 @@ class AccessMangApi {
|
||||
path: ApiEndpoints.visitorPassword,
|
||||
showServerMessage: true,
|
||||
expectedResponseModel: (json) {
|
||||
print(json);
|
||||
List<dynamic> jsonData = json;
|
||||
List<PasswordModel> passwordList = jsonData.map((jsonItem) {
|
||||
return PasswordModel.fromJson(jsonItem);
|
||||
|
Reference in New Issue
Block a user