mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-11-27 18:14:56 +00:00
@ -30,7 +30,7 @@ class AccessManagementPage extends StatelessWidget with HelperResponsiveLayout {
|
|||||||
final padding = isLargeScreen ? const EdgeInsets.all(30) : const EdgeInsets.all(15);
|
final padding = isLargeScreen ? const EdgeInsets.all(30) : const EdgeInsets.all(15);
|
||||||
|
|
||||||
return WebScaffold(
|
return WebScaffold(
|
||||||
enableMenuSideba: false,
|
enableMenuSidebar: false,
|
||||||
appBarTitle: FittedBox(
|
appBarTitle: FittedBox(
|
||||||
child: Text(
|
child: Text(
|
||||||
'Access Management',
|
'Access Management',
|
||||||
|
|||||||
@ -1,7 +1,10 @@
|
|||||||
|
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
class HourPickerDialog extends StatefulWidget {
|
class HourPickerDialog extends StatefulWidget {
|
||||||
final TimeOfDay initialTime;
|
final TimeOfDay initialTime;
|
||||||
|
|
||||||
const HourPickerDialog({super.key, required this.initialTime});
|
const HourPickerDialog({super.key, required this.initialTime});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -9,70 +12,50 @@ class HourPickerDialog extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _HourPickerDialogState extends State<HourPickerDialog> {
|
class _HourPickerDialogState extends State<HourPickerDialog> {
|
||||||
late int _selectedHour;
|
late String selectedHour;
|
||||||
bool _isPm = true;
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
_selectedHour = widget.initialTime.hour > 12
|
// Initialize the selectedHour with the initial time passed to the dialog
|
||||||
? widget.initialTime.hour - 12
|
selectedHour = widget.initialTime.hour.toString().padLeft(2, '0') + ':00';
|
||||||
: widget.initialTime.hour;
|
|
||||||
_isPm = widget.initialTime.period == DayPeriod.am;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return AlertDialog(
|
return AlertDialog(
|
||||||
title: const Text('Select Hour'),
|
title: const Text('Select Hour'),
|
||||||
content: Row(
|
content: DropdownButton<String>(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
value: selectedHour, // Show the currently selected hour
|
||||||
children: [
|
items: List.generate(24, (index) {
|
||||||
DropdownButton<int>(
|
String hour = index.toString().padLeft(2, '0');
|
||||||
value: _selectedHour,
|
return DropdownMenuItem<String>(
|
||||||
items: List.generate(12, (index) {
|
value: '$hour:00',
|
||||||
int displayHour = index + 1;
|
child: Text('$hour:00'),
|
||||||
return DropdownMenuItem(
|
|
||||||
value: displayHour,
|
|
||||||
child: Text(displayHour.toString()),
|
|
||||||
);
|
);
|
||||||
}),
|
}),
|
||||||
onChanged: (value) {
|
onChanged: (String? newValue) {
|
||||||
|
if (newValue != null) {
|
||||||
setState(() {
|
setState(() {
|
||||||
_selectedHour = value!;
|
selectedHour = newValue; // Update the selected hour without closing the dialog
|
||||||
});
|
});
|
||||||
|
}
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
SizedBox(width: 16.0),
|
|
||||||
DropdownButton<bool>(
|
|
||||||
value: _isPm,
|
|
||||||
items: const [
|
|
||||||
DropdownMenuItem(
|
|
||||||
value: true,
|
|
||||||
child: Text('AM'),
|
|
||||||
),
|
|
||||||
DropdownMenuItem(
|
|
||||||
value:false ,
|
|
||||||
child: Text('PM'),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
onChanged: (value) {
|
|
||||||
setState(() {
|
|
||||||
_isPm = value!;
|
|
||||||
});
|
|
||||||
},
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
actions: [
|
actions: [
|
||||||
TextButton(
|
TextButton(
|
||||||
onPressed: () => Navigator.of(context).pop(null),
|
onPressed: () => Navigator.of(context).pop(null), // Close the dialog without selection
|
||||||
child: const Text('Cancel'),
|
child: const Text('Cancel'),
|
||||||
),
|
),
|
||||||
TextButton(
|
TextButton(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
int hour = _isPm ? _selectedHour + 12 : _selectedHour;
|
// Close the dialog and return the selected time
|
||||||
Navigator.of(context).pop(TimeOfDay(hour: hour, minute: 0));
|
Navigator.of(context).pop(
|
||||||
|
TimeOfDay(
|
||||||
|
hour: int.parse(selectedHour.split(':')[0]),
|
||||||
|
minute: 0,
|
||||||
|
),
|
||||||
|
);
|
||||||
},
|
},
|
||||||
child: const Text('OK'),
|
child: const Text('OK'),
|
||||||
),
|
),
|
||||||
@ -86,6 +69,7 @@ Future<TimeOfDay?> showHourPicker({
|
|||||||
required TimeOfDay initialTime,
|
required TimeOfDay initialTime,
|
||||||
}) {
|
}) {
|
||||||
return showDialog<TimeOfDay>(
|
return showDialog<TimeOfDay>(
|
||||||
|
barrierDismissible: false,
|
||||||
context: context,
|
context: context,
|
||||||
builder: (context) => HourPickerDialog(initialTime: initialTime),
|
builder: (context) => HourPickerDialog(initialTime: initialTime),
|
||||||
);
|
);
|
||||||
|
|||||||
@ -21,13 +21,11 @@ class DeviceManagementPage extends StatelessWidget with HelperResponsiveLayout {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
rightBody: const NavigateHomeGridView(),
|
rightBody: const NavigateHomeGridView(),
|
||||||
enableMenuSideba: isLargeScreenSize(context),
|
|
||||||
scaffoldBody: BlocBuilder<DeviceManagementBloc, DeviceManagementState>(
|
scaffoldBody: BlocBuilder<DeviceManagementBloc, DeviceManagementState>(
|
||||||
builder: (context, state) {
|
builder: (context, state) {
|
||||||
if (state is DeviceManagementLoading) {
|
if (state is DeviceManagementLoading) {
|
||||||
return const Center(child: CircularProgressIndicator());
|
return const Center(child: CircularProgressIndicator());
|
||||||
} else if (state is DeviceManagementLoaded ||
|
} else if (state is DeviceManagementLoaded || state is DeviceManagementFiltered) {
|
||||||
state is DeviceManagementFiltered) {
|
|
||||||
final devices = state is DeviceManagementLoaded
|
final devices = state is DeviceManagementLoaded
|
||||||
? state.devices
|
? state.devices
|
||||||
: (state as DeviceManagementFiltered).filteredDevices;
|
: (state as DeviceManagementFiltered).filteredDevices;
|
||||||
|
|||||||
@ -116,7 +116,7 @@ class DeviceManagementBody extends StatelessWidget with HelperResponsiveLayout {
|
|||||||
? const EdgeInsets.all(30)
|
? const EdgeInsets.all(30)
|
||||||
: const EdgeInsets.all(15),
|
: const EdgeInsets.all(15),
|
||||||
child: DynamicTable(
|
child: DynamicTable(
|
||||||
withSelectAll: true,
|
withSelectAll: false,
|
||||||
cellDecoration: containerDecoration,
|
cellDecoration: containerDecoration,
|
||||||
onRowSelected: (index, isSelected, row) {
|
onRowSelected: (index, isSelected, row) {
|
||||||
final selectedDevice = devicesToShow[index];
|
final selectedDevice = devicesToShow[index];
|
||||||
|
|||||||
@ -18,7 +18,7 @@ class HomeMobilePage extends StatelessWidget {
|
|||||||
canPop: false,
|
canPop: false,
|
||||||
onPopInvoked: (didPop) => false,
|
onPopInvoked: (didPop) => false,
|
||||||
child: WebScaffold(
|
child: WebScaffold(
|
||||||
enableMenuSideba: false,
|
enableMenuSidebar: false,
|
||||||
appBarTitle: Row(
|
appBarTitle: Row(
|
||||||
children: [
|
children: [
|
||||||
SvgPicture.asset(
|
SvgPicture.asset(
|
||||||
@ -41,8 +41,7 @@ class HomeMobilePage extends StatelessWidget {
|
|||||||
SizedBox(height: size.height * 0.05),
|
SizedBox(height: size.height * 0.05),
|
||||||
const Text(
|
const Text(
|
||||||
'ACCESS YOUR APPS',
|
'ACCESS YOUR APPS',
|
||||||
style:
|
style: TextStyle(fontSize: 20, fontWeight: FontWeight.w700),
|
||||||
TextStyle(fontSize: 20, fontWeight: FontWeight.w700),
|
|
||||||
),
|
),
|
||||||
const SizedBox(height: 30),
|
const SizedBox(height: 30),
|
||||||
Expanded(
|
Expanded(
|
||||||
@ -52,8 +51,7 @@ class HomeMobilePage extends StatelessWidget {
|
|||||||
width: size.width * 0.68,
|
width: size.width * 0.68,
|
||||||
child: GridView.builder(
|
child: GridView.builder(
|
||||||
itemCount: 8,
|
itemCount: 8,
|
||||||
gridDelegate:
|
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
|
||||||
const SliverGridDelegateWithFixedCrossAxisCount(
|
|
||||||
crossAxisCount: 2,
|
crossAxisCount: 2,
|
||||||
crossAxisSpacing: 20.0,
|
crossAxisSpacing: 20.0,
|
||||||
mainAxisSpacing: 20.0,
|
mainAxisSpacing: 20.0,
|
||||||
@ -65,8 +63,7 @@ class HomeMobilePage extends StatelessWidget {
|
|||||||
active: homeItems[index]['active'],
|
active: homeItems[index]['active'],
|
||||||
name: homeItems[index]['title'],
|
name: homeItems[index]['title'],
|
||||||
img: homeItems[index]['icon'],
|
img: homeItems[index]['icon'],
|
||||||
onTap: () =>
|
onTap: () => homeBloc.homeItems[index].onPress(context),
|
||||||
homeBloc.homeItems[index].onPress(context),
|
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
|||||||
@ -20,7 +20,7 @@ class HomeWebPage extends StatelessWidget {
|
|||||||
builder: (context, state) {
|
builder: (context, state) {
|
||||||
final homeBloc = BlocProvider.of<HomeBloc>(context);
|
final homeBloc = BlocProvider.of<HomeBloc>(context);
|
||||||
return WebScaffold(
|
return WebScaffold(
|
||||||
enableMenuSideba: false,
|
enableMenuSidebar: false,
|
||||||
appBarTitle: Row(
|
appBarTitle: Row(
|
||||||
children: [
|
children: [
|
||||||
SvgPicture.asset(
|
SvgPicture.asset(
|
||||||
|
|||||||
@ -32,9 +32,9 @@ class VisitorPasswordBloc extends Bloc<VisitorPasswordEvent, VisitorPasswordStat
|
|||||||
on<SelectTimeEvent>(selectTimeOfLinePassword);
|
on<SelectTimeEvent>(selectTimeOfLinePassword);
|
||||||
on<ChangeTimeEvent>(changeTime);
|
on<ChangeTimeEvent>(changeTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
final TextEditingController userNameController = TextEditingController();
|
final TextEditingController userNameController = TextEditingController();
|
||||||
final TextEditingController emailController = TextEditingController();
|
final TextEditingController emailController = TextEditingController();
|
||||||
|
|
||||||
final TextEditingController deviceNameController = TextEditingController();
|
final TextEditingController deviceNameController = TextEditingController();
|
||||||
final TextEditingController deviceIdController = TextEditingController();
|
final TextEditingController deviceIdController = TextEditingController();
|
||||||
final TextEditingController unitNameController = TextEditingController();
|
final TextEditingController unitNameController = TextEditingController();
|
||||||
@ -51,6 +51,7 @@ class VisitorPasswordBloc extends Bloc<VisitorPasswordEvent, VisitorPasswordStat
|
|||||||
String accessTypeSelected = 'Online Password';
|
String accessTypeSelected = 'Online Password';
|
||||||
String usageFrequencySelected = 'One-Time';
|
String usageFrequencySelected = 'One-Time';
|
||||||
String passwordController = '';
|
String passwordController = '';
|
||||||
|
String accessPeriodValidate = '';
|
||||||
|
|
||||||
bool repeat = false;
|
bool repeat = false;
|
||||||
|
|
||||||
@ -377,19 +378,18 @@ class VisitorPasswordBloc extends Bloc<VisitorPasswordEvent, VisitorPasswordStat
|
|||||||
1000; // Divide by 1000 to remove milliseconds
|
1000; // Divide by 1000 to remove milliseconds
|
||||||
if (event.isEffective) {
|
if (event.isEffective) {
|
||||||
if (expirationTimeTimeStamp != null && selectedTimestamp > expirationTimeTimeStamp!) {
|
if (expirationTimeTimeStamp != null && selectedTimestamp > expirationTimeTimeStamp!) {
|
||||||
CustomSnackBar.displaySnackBar('Effective Time cannot be later than Expiration Time.');
|
accessPeriodValidate = "Effective Time cannot be later than Expiration Time.";
|
||||||
} else {
|
} else {
|
||||||
effectiveTime =
|
accessPeriodValidate = '';
|
||||||
selectedDateTime.toString().split('.').first; // Remove seconds and milliseconds
|
effectiveTime = selectedDateTime.toString().split('.').first;
|
||||||
effectiveTimeTimeStamp = selectedTimestamp;
|
effectiveTimeTimeStamp = selectedTimestamp;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (effectiveTimeTimeStamp != null && selectedTimestamp < effectiveTimeTimeStamp!) {
|
if (effectiveTimeTimeStamp != null && selectedTimestamp < effectiveTimeTimeStamp!) {
|
||||||
CustomSnackBar.displaySnackBar(
|
accessPeriodValidate = 'Expiration Time cannot be earlier than Effective Time.';
|
||||||
'Expiration Time cannot be earlier than Effective Time.');
|
|
||||||
} else {
|
} else {
|
||||||
expirationTime =
|
accessPeriodValidate = '';
|
||||||
selectedDateTime.toString().split('.').first; // Remove seconds and milliseconds
|
expirationTime = selectedDateTime.toString().split('.').first;
|
||||||
expirationTimeTimeStamp = selectedTimestamp;
|
expirationTimeTimeStamp = selectedTimestamp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -448,7 +448,6 @@ class VisitorPasswordBloc extends Bloc<VisitorPasswordEvent, VisitorPasswordStat
|
|||||||
<Widget>[
|
<Widget>[
|
||||||
TextButton(
|
TextButton(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
|
|
||||||
Navigator.of(context).pop(true);
|
Navigator.of(context).pop(true);
|
||||||
},
|
},
|
||||||
child: const Text('OK'),
|
child: const Text('OK'),
|
||||||
|
|||||||
@ -404,6 +404,9 @@ class VisitorPasswordDialog extends StatelessWidget {
|
|||||||
? visitorBloc.expirationTime
|
? visitorBloc.expirationTime
|
||||||
: visitorBloc.endTimeAccess.toString(),
|
: visitorBloc.endTimeAccess.toString(),
|
||||||
icon: Assets.calendarIcon),
|
icon: Assets.calendarIcon),
|
||||||
|
const SizedBox(height: 10,),
|
||||||
|
Text(visitorBloc.accessPeriodValidate,
|
||||||
|
style: Theme.of(context).textTheme.bodyMedium!.copyWith(color: ColorsManager.red),),
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
height: 20,
|
height: 20,
|
||||||
),
|
),
|
||||||
|
|||||||
@ -41,3 +41,4 @@ BoxDecoration containerDecoration = BoxDecoration(
|
|||||||
],
|
],
|
||||||
color: ColorsManager.boxColor,
|
color: ColorsManager.boxColor,
|
||||||
borderRadius: const BorderRadius.all(Radius.circular(10)));
|
borderRadius: const BorderRadius.all(Radius.circular(10)));
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,7 @@ import 'package:syncrow_web/web_layout/web_app_bar.dart';
|
|||||||
import 'menu_sidebar.dart';
|
import 'menu_sidebar.dart';
|
||||||
|
|
||||||
class WebScaffold extends StatelessWidget with HelperResponsiveLayout {
|
class WebScaffold extends StatelessWidget with HelperResponsiveLayout {
|
||||||
final bool enableMenuSideba;
|
final bool enableMenuSidebar;
|
||||||
final Widget? appBarTitle;
|
final Widget? appBarTitle;
|
||||||
final Widget? centerBody;
|
final Widget? centerBody;
|
||||||
final Widget? rightBody;
|
final Widget? rightBody;
|
||||||
@ -17,7 +17,7 @@ class WebScaffold extends StatelessWidget with HelperResponsiveLayout {
|
|||||||
this.centerBody,
|
this.centerBody,
|
||||||
this.rightBody,
|
this.rightBody,
|
||||||
this.scaffoldBody,
|
this.scaffoldBody,
|
||||||
this.enableMenuSideba = true,
|
this.enableMenuSidebar = false,
|
||||||
});
|
});
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
@ -49,7 +49,7 @@ class WebScaffold extends StatelessWidget with HelperResponsiveLayout {
|
|||||||
Expanded(
|
Expanded(
|
||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
if (enableMenuSideba && !isSmall) const MenuSidebar(),
|
if (enableMenuSidebar && !isSmall) const MenuSidebar(),
|
||||||
Expanded(flex: 5, child: scaffoldBody!)
|
Expanded(flex: 5, child: scaffoldBody!)
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|||||||
@ -50,7 +50,6 @@ dependencies:
|
|||||||
dropdown_search: ^5.0.6
|
dropdown_search: ^5.0.6
|
||||||
flutter_dotenv: ^5.1.0
|
flutter_dotenv: ^5.1.0
|
||||||
|
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
flutter_test:
|
flutter_test:
|
||||||
sdk: flutter
|
sdk: flutter
|
||||||
|
|||||||
Reference in New Issue
Block a user