mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-07-09 22:57:21 +00:00
fix bugs and fix send otp and sp-392 and sp-372
This commit is contained in:
18
assets/images/grid.svg
Normal file
18
assets/images/grid.svg
Normal file
@ -0,0 +1,18 @@
|
||||
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<g clip-path="url(#clip0_1423_2976)">
|
||||
<path d="M4.5 17.5004H2C1.46957 17.5004 0.960859 17.7111 0.585786 18.0862C0.210714 18.4612 0 18.9699 0 19.5004L0 22.0004C0 22.5308 0.210714 23.0395 0.585786 23.4146C0.960859 23.7896 1.46957 24.0004 2 24.0004H4.5C5.03043 24.0004 5.53914 23.7896 5.91421 23.4146C6.28929 23.0395 6.5 22.5308 6.5 22.0004V19.5004C6.5 18.9699 6.28929 18.4612 5.91421 18.0862C5.53914 17.7111 5.03043 17.5004 4.5 17.5004ZM4.5 22.0004H2V19.5004H4.5V22.0004Z" fill="white"/>
|
||||
<path d="M22 17.5004H19.5C18.9696 17.5004 18.4609 17.7111 18.0858 18.0862C17.7107 18.4612 17.5 18.9699 17.5 19.5004V22.0004C17.5 22.5308 17.7107 23.0395 18.0858 23.4146C18.4609 23.7896 18.9696 24.0004 19.5 24.0004H22C22.5304 24.0004 23.0391 23.7896 23.4142 23.4146C23.7893 23.0395 24 22.5308 24 22.0004V19.5004C24 18.9699 23.7893 18.4612 23.4142 18.0862C23.0391 17.7111 22.5304 17.5004 22 17.5004ZM22 22.0004H19.5V19.5004H22V22.0004Z" fill="white"/>
|
||||
<path d="M4.5 8.74976H2C1.46957 8.74976 0.960859 8.96047 0.585786 9.33554C0.210714 9.71061 0 10.2193 0 10.7498L0 13.2497C0 13.7802 0.210714 14.2889 0.585786 14.664C0.960859 15.039 1.46957 15.2497 2 15.2497H4.5C5.03043 15.2497 5.53914 15.039 5.91421 14.664C6.28929 14.2889 6.5 13.7802 6.5 13.2497V10.7498C6.5 10.2193 6.28929 9.71061 5.91421 9.33554C5.53914 8.96047 5.03043 8.74976 4.5 8.74976ZM4.5 13.2497H2V10.7498H4.5V13.2497Z" fill="white"/>
|
||||
<path d="M22 8.74976H19.5C18.9696 8.74976 18.4609 8.96047 18.0858 9.33554C17.7107 9.71061 17.5 10.2193 17.5 10.7498V13.2497C17.5 13.7802 17.7107 14.2889 18.0858 14.664C18.4609 15.039 18.9696 15.2497 19.5 15.2497H22C22.5304 15.2497 23.0391 15.039 23.4142 14.664C23.7893 14.2889 24 13.7802 24 13.2497V10.7498C24 10.2193 23.7893 9.71061 23.4142 9.33554C23.0391 8.96047 22.5304 8.74976 22 8.74976ZM22 13.2497H19.5V10.7498H22V13.2497Z" fill="white"/>
|
||||
<path d="M4.5 0H2C1.46957 0 0.960859 0.210714 0.585786 0.585786C0.210714 0.960859 0 1.46957 0 2L0 4.5C0 5.03043 0.210714 5.53914 0.585786 5.91421C0.960859 6.28929 1.46957 6.5 2 6.5H4.5C5.03043 6.5 5.53914 6.28929 5.91421 5.91421C6.28929 5.53914 6.5 5.03043 6.5 4.5V2C6.5 1.46957 6.28929 0.960859 5.91421 0.585786C5.53914 0.210714 5.03043 0 4.5 0V0ZM4.5 4.5H2V2H4.5V4.5Z" fill="white"/>
|
||||
<path d="M13.25 17.5004H10.75C10.2196 17.5004 9.71086 17.7111 9.33579 18.0862C8.96071 18.4612 8.75 18.9699 8.75 19.5004V22.0004C8.75 22.5308 8.96071 23.0395 9.33579 23.4146C9.71086 23.7896 10.2196 24.0004 10.75 24.0004H13.25C13.7804 24.0004 14.2891 23.7896 14.6642 23.4146C15.0393 23.0395 15.25 22.5308 15.25 22.0004V19.5004C15.25 18.9699 15.0393 18.4612 14.6642 18.0862C14.2891 17.7111 13.7804 17.5004 13.25 17.5004ZM13.25 22.0004H10.75V19.5004H13.25V22.0004Z" fill="white"/>
|
||||
<path d="M13.25 8.74976H10.75C10.2196 8.74976 9.71086 8.96047 9.33579 9.33554C8.96071 9.71061 8.75 10.2193 8.75 10.7498V13.2497C8.75 13.7802 8.96071 14.2889 9.33579 14.664C9.71086 15.039 10.2196 15.2497 10.75 15.2497H13.25C13.7804 15.2497 14.2891 15.039 14.6642 14.664C15.0393 14.2889 15.25 13.7802 15.25 13.2497V10.7498C15.25 10.2193 15.0393 9.71061 14.6642 9.33554C14.2891 8.96047 13.7804 8.74976 13.25 8.74976ZM13.25 13.2497H10.75V10.7498H13.25V13.2497Z" fill="white"/>
|
||||
<path d="M13.25 0H10.75C10.2196 0 9.71086 0.210714 9.33579 0.585786C8.96071 0.960859 8.75 1.46957 8.75 2V4.5C8.75 5.03043 8.96071 5.53914 9.33579 5.91421C9.71086 6.28929 10.2196 6.5 10.75 6.5H13.25C13.7804 6.5 14.2891 6.28929 14.6642 5.91421C15.0393 5.53914 15.25 5.03043 15.25 4.5V2C15.25 1.46957 15.0393 0.960859 14.6642 0.585786C14.2891 0.210714 13.7804 0 13.25 0V0ZM13.25 4.5H10.75V2H13.25V4.5Z" fill="white"/>
|
||||
<path d="M22 0H19.5C18.9696 0 18.4609 0.210714 18.0858 0.585786C17.7107 0.960859 17.5 1.46957 17.5 2V4.5C17.5 5.03043 17.7107 5.53914 18.0858 5.91421C18.4609 6.28929 18.9696 6.5 19.5 6.5H22C22.5304 6.5 23.0391 6.28929 23.4142 5.91421C23.7893 5.53914 24 5.03043 24 4.5V2C24 1.46957 23.7893 0.960859 23.4142 0.585786C23.0391 0.210714 22.5304 0 22 0V0ZM22 4.5H19.5V2H22V4.5Z" fill="white"/>
|
||||
</g>
|
||||
<defs>
|
||||
<clipPath id="clip0_1423_2976">
|
||||
<rect width="24" height="24" fill="white"/>
|
||||
</clipPath>
|
||||
</defs>
|
||||
</svg>
|
After Width: | Height: | Size: 4.1 KiB |
4
devtools_options.yaml
Normal file
4
devtools_options.yaml
Normal file
@ -0,0 +1,4 @@
|
||||
description: This file stores settings for Dart & Flutter DevTools.
|
||||
documentation: https://docs.flutter.dev/tools/devtools/extensions#configure-extension-enablement-states
|
||||
extensions:
|
||||
- provider: true
|
36
ios/Podfile.lock
Normal file
36
ios/Podfile.lock
Normal file
@ -0,0 +1,36 @@
|
||||
PODS:
|
||||
- Flutter (1.0.0)
|
||||
- flutter_secure_storage (6.0.0):
|
||||
- Flutter
|
||||
- path_provider_foundation (0.0.1):
|
||||
- Flutter
|
||||
- FlutterMacOS
|
||||
- shared_preferences_foundation (0.0.1):
|
||||
- Flutter
|
||||
- FlutterMacOS
|
||||
|
||||
DEPENDENCIES:
|
||||
- Flutter (from `Flutter`)
|
||||
- flutter_secure_storage (from `.symlinks/plugins/flutter_secure_storage/ios`)
|
||||
- path_provider_foundation (from `.symlinks/plugins/path_provider_foundation/darwin`)
|
||||
- shared_preferences_foundation (from `.symlinks/plugins/shared_preferences_foundation/darwin`)
|
||||
|
||||
EXTERNAL SOURCES:
|
||||
Flutter:
|
||||
:path: Flutter
|
||||
flutter_secure_storage:
|
||||
:path: ".symlinks/plugins/flutter_secure_storage/ios"
|
||||
path_provider_foundation:
|
||||
:path: ".symlinks/plugins/path_provider_foundation/darwin"
|
||||
shared_preferences_foundation:
|
||||
:path: ".symlinks/plugins/shared_preferences_foundation/darwin"
|
||||
|
||||
SPEC CHECKSUMS:
|
||||
Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7
|
||||
flutter_secure_storage: d33dac7ae2ea08509be337e775f6b59f1ff45f12
|
||||
path_provider_foundation: 2b6b4c569c0fb62ec74538f866245ac84301af46
|
||||
shared_preferences_foundation: fcdcbc04712aee1108ac7fda236f363274528f78
|
||||
|
||||
PODFILE CHECKSUM: 819463e6a0290f5a72f145ba7cde16e8b6ef0796
|
||||
|
||||
COCOAPODS: 1.15.2
|
@ -1,30 +1,39 @@
|
||||
import 'package:flutter/gestures.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:syncrow_web/pages/access_management/view/access_management.dart';
|
||||
import 'package:syncrow_web/pages/auth/bloc/auth_bloc.dart';
|
||||
import 'package:syncrow_web/pages/auth/view/login_page.dart';
|
||||
import 'package:syncrow_web/pages/home/bloc/home_bloc.dart';
|
||||
import 'package:syncrow_web/pages/home/view/home_page.dart';
|
||||
import 'package:syncrow_web/pages/spaseManagementIcon.dart';
|
||||
import 'package:syncrow_web/pages/visitor_password/bloc/visitor_password_bloc.dart';
|
||||
import 'package:syncrow_web/pages/visitor_password/view/visitor_password_dialog.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:syncrow_web/services/locator.dart';
|
||||
import 'package:syncrow_web/utils/app_routes.dart';
|
||||
import 'package:syncrow_web/utils/color_manager.dart';
|
||||
import 'package:syncrow_web/utils/constants/routes_const.dart';
|
||||
|
||||
Future<void> main() async {
|
||||
WidgetsFlutterBinding.ensureInitialized();
|
||||
initialSetup(); // Perform initial setup, e.g., dependency injection
|
||||
initialSetup();
|
||||
String checkToken = await AuthBloc.getTokenAndValidate();
|
||||
GoRouter router = GoRouter(
|
||||
initialLocation: checkToken == 'Success' ? RoutesConst.home :RoutesConst.main ,
|
||||
routes: AppRoutes.getRoutes(),
|
||||
);
|
||||
runApp(MyApp(
|
||||
isLoggedIn: checkToken,
|
||||
router: router,
|
||||
));
|
||||
}
|
||||
|
||||
class MyApp extends StatelessWidget {
|
||||
final dynamic isLoggedIn;
|
||||
final GoRouter router;
|
||||
const MyApp({
|
||||
super.key,
|
||||
required this.isLoggedIn,
|
||||
required this.router,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return MultiBlocProvider(
|
||||
@ -33,7 +42,7 @@ class MyApp extends StatelessWidget {
|
||||
BlocProvider<VisitorPasswordBloc>(
|
||||
create: (context) => VisitorPasswordBloc(),)
|
||||
],
|
||||
child: MaterialApp(
|
||||
child: MaterialApp.router(
|
||||
debugShowCheckedModeBanner: false, // Hide debug banner
|
||||
scrollBehavior: const MaterialScrollBehavior().copyWith(
|
||||
dragDevices: {
|
||||
@ -60,8 +69,16 @@ class MyApp extends StatelessWidget {
|
||||
colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple), // Set up color scheme
|
||||
useMaterial3: true, // Enable Material 3
|
||||
),
|
||||
// home:VisitorPasswordDialog(),
|
||||
home:isLoggedIn == 'Success' ? const HomePage() : const LoginPage(),
|
||||
|
||||
routeInformationProvider: router.routeInformationProvider,
|
||||
routerDelegate: router.routerDelegate,
|
||||
routeInformationParser: router.routeInformationParser,
|
||||
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -5,7 +5,7 @@ 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/services/access_mang_api.dart';
|
||||
import 'package:syncrow_web/utils/color_manager.dart';
|
||||
import 'package:syncrow_web/utils/constants/const.dart';
|
||||
import 'package:syncrow_web/utils/constants/app_enum.dart';
|
||||
import 'package:syncrow_web/utils/snack_bar.dart';
|
||||
|
||||
class AccessBloc extends Bloc<AccessEvent, AccessState> {
|
||||
|
@ -1,4 +1,4 @@
|
||||
import 'package:syncrow_web/utils/constants/const.dart';
|
||||
import 'package:syncrow_web/utils/constants/app_enum.dart';
|
||||
|
||||
class PasswordModel {
|
||||
final dynamic passwordId;
|
||||
|
@ -1,5 +1,7 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:flutter_svg/flutter_svg.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:syncrow_web/pages/access_management/bloc/access_bloc.dart';
|
||||
import 'package:syncrow_web/pages/access_management/bloc/access_event.dart';
|
||||
import 'package:syncrow_web/pages/access_management/bloc/access_state.dart';
|
||||
@ -7,10 +9,12 @@ import 'package:syncrow_web/pages/common/custom_table.dart';
|
||||
import 'package:syncrow_web/pages/common/custom_web_textfield.dart';
|
||||
import 'package:syncrow_web/pages/common/date_time_widget.dart';
|
||||
import 'package:syncrow_web/pages/common/default_button.dart';
|
||||
import 'package:syncrow_web/pages/home/view/home_page.dart';
|
||||
import 'package:syncrow_web/pages/visitor_password/view/visitor_password_dialog.dart';
|
||||
import 'package:syncrow_web/utils/color_manager.dart';
|
||||
import 'package:syncrow_web/utils/constants/assets.dart';
|
||||
import 'package:syncrow_web/utils/constants/const.dart';
|
||||
import 'package:syncrow_web/utils/constants/app_enum.dart';
|
||||
import 'package:syncrow_web/utils/constants/routes_const.dart';
|
||||
import 'package:syncrow_web/utils/style.dart';
|
||||
import 'package:syncrow_web/web_layout/web_scaffold.dart';
|
||||
|
||||
@ -18,6 +22,7 @@ class AccessManagementPage extends StatelessWidget {
|
||||
const AccessManagementPage({super.key});
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
||||
Size size = MediaQuery.of(context).size;
|
||||
return WebScaffold(
|
||||
enableMenuSideba: false,
|
||||
@ -29,231 +34,252 @@ class AccessManagementPage extends StatelessWidget {
|
||||
],
|
||||
),
|
||||
appBarBody: [
|
||||
Text('Physical Access',
|
||||
style: Theme.of(context).textTheme
|
||||
.headlineMedium!
|
||||
.copyWith(color: Colors.white),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text('Physical Access',
|
||||
style: Theme.of(context).textTheme.headlineMedium!
|
||||
.copyWith(color: Colors.white),
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
InkWell(
|
||||
onTap: () {
|
||||
context.go(RoutesConst.home);
|
||||
},
|
||||
child: SvgPicture.asset(
|
||||
height: 20,
|
||||
width: 20,
|
||||
Assets.grid,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 10,)
|
||||
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
scaffoldBody: BlocProvider(create: (BuildContext context) => AccessBloc()..add(FetchTableData()),
|
||||
child: BlocConsumer<AccessBloc, AccessState>(listener: (context, state) {
|
||||
}, builder: (context, state) {
|
||||
final accessBloc = BlocProvider.of<AccessBloc>(context);
|
||||
final filteredData = accessBloc.filteredData;
|
||||
return state is AccessLoaded?
|
||||
const Center(child: CircularProgressIndicator()):
|
||||
Container(
|
||||
padding: EdgeInsets.all(30),
|
||||
height: size.height,
|
||||
width: size.width,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Container(
|
||||
decoration: containerDecoration,
|
||||
height: size.height * 0.05,
|
||||
child: Flexible(
|
||||
child: ListView.builder(
|
||||
scrollDirection: Axis.horizontal,
|
||||
itemCount: BlocProvider.of<AccessBloc>(context).tabs.length,
|
||||
shrinkWrap: true,
|
||||
itemBuilder: (context, index) {
|
||||
final isSelected = index == BlocProvider.of<AccessBloc>(context).selectedIndex;
|
||||
return InkWell(
|
||||
onTap: () {
|
||||
BlocProvider.of<AccessBloc>(context).add(TabChangedEvent(index));
|
||||
},
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
color: ColorsManager.boxColor,
|
||||
border: Border.all(
|
||||
color: isSelected ? Colors.blue : Colors.transparent,
|
||||
width: 2.0,
|
||||
child: BlocConsumer<AccessBloc, AccessState>(listener: (context, state) {},
|
||||
builder: (context, state) {
|
||||
final accessBloc = BlocProvider.of<AccessBloc>(context);
|
||||
final filteredData = accessBloc.filteredData;
|
||||
return state is AccessLoaded?
|
||||
const Center(child: CircularProgressIndicator()):
|
||||
Container(
|
||||
padding: EdgeInsets.all(30),
|
||||
height: size.height,
|
||||
width: size.width,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Container(
|
||||
decoration: containerDecoration,
|
||||
height: size.height * 0.05,
|
||||
child: Flexible(
|
||||
child: ListView.builder(
|
||||
scrollDirection: Axis.horizontal,
|
||||
itemCount: BlocProvider.of<AccessBloc>(context).tabs.length,
|
||||
shrinkWrap: true,
|
||||
itemBuilder: (context, index) {
|
||||
final isSelected = index == BlocProvider.of<AccessBloc>(context).selectedIndex;
|
||||
return InkWell(
|
||||
onTap: () {
|
||||
BlocProvider.of<AccessBloc>(context).add(TabChangedEvent(index));
|
||||
},
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
color: ColorsManager.boxColor,
|
||||
border: Border.all(
|
||||
color: isSelected ? Colors.blue : Colors.transparent,
|
||||
width: 2.0,
|
||||
),
|
||||
borderRadius: index == 0
|
||||
? const BorderRadius.only(
|
||||
topLeft: Radius.circular(10),
|
||||
bottomLeft: Radius.circular(10))
|
||||
: index == 3
|
||||
? const BorderRadius.only(
|
||||
topRight: Radius.circular(10),
|
||||
bottomRight: Radius.circular(10))
|
||||
: null,
|
||||
),
|
||||
borderRadius: index == 0
|
||||
? const BorderRadius.only(
|
||||
topLeft: Radius.circular(10),
|
||||
bottomLeft: Radius.circular(10))
|
||||
: index == 3
|
||||
? const BorderRadius.only(
|
||||
topRight: Radius.circular(10),
|
||||
bottomRight: Radius.circular(10))
|
||||
: null,
|
||||
),
|
||||
padding: const EdgeInsets.only(left: 10, right: 10),
|
||||
child: Center(
|
||||
child: Text(
|
||||
BlocProvider.of<AccessBloc>(context).tabs[index],
|
||||
style: TextStyle(
|
||||
color: isSelected ? Colors.blue : Colors.black,
|
||||
padding: const EdgeInsets.only(left: 10, right: 10),
|
||||
child: Center(
|
||||
child: Text(
|
||||
BlocProvider.of<AccessBloc>(context).tabs[index],
|
||||
style: TextStyle(
|
||||
color: isSelected ? Colors.blue : Colors.black,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
textBaseline: TextBaseline.ideographic, children: [
|
||||
Container(
|
||||
width: size.width * 0.15,
|
||||
child: CustomWebTextField(
|
||||
controller: accessBloc.passwordName,
|
||||
isRequired: true,
|
||||
textFieldName: 'Name',
|
||||
description: '',
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
width: 15,
|
||||
),
|
||||
DateTimeWebWidget(
|
||||
icon: Assets.calendarIcon,
|
||||
isRequired: false,
|
||||
title: 'Access Time',
|
||||
size: size,
|
||||
endTime: () {
|
||||
accessBloc.add(SelectTime(context: context, isStart: false));
|
||||
},
|
||||
startTime: () {
|
||||
accessBloc.add(SelectTime(context: context, isStart: true));
|
||||
},
|
||||
firstString:BlocProvider.of<AccessBloc>(context).startTime ,
|
||||
secondString:BlocProvider.of<AccessBloc>(context).endTime ,
|
||||
) ,
|
||||
const SizedBox(
|
||||
width: 15,
|
||||
),
|
||||
|
||||
SizedBox(
|
||||
|
||||
width: size.width * 0.06,
|
||||
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(
|
||||
width: size.width * 0.06,
|
||||
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),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
Wrap(
|
||||
children: [
|
||||
Container(
|
||||
width: size.width * 0.15,
|
||||
decoration: containerDecoration,
|
||||
child: DefaultButton(
|
||||
onPressed: () {
|
||||
showDialog(
|
||||
context: context,
|
||||
barrierDismissible: false,
|
||||
builder: (BuildContext context) {
|
||||
return const VisitorPasswordDialog();
|
||||
},
|
||||
).then((v){
|
||||
if(v!=null){
|
||||
accessBloc.add(FetchTableData());
|
||||
}
|
||||
});
|
||||
},
|
||||
borderRadius: 8,
|
||||
child: const Text('+ Create Visitor Password ')),
|
||||
const SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
textBaseline: TextBaseline.ideographic,
|
||||
children: [
|
||||
Container(
|
||||
width: size.width * 0.15,
|
||||
child: CustomWebTextField(
|
||||
controller: accessBloc.passwordName,
|
||||
isRequired: true,
|
||||
textFieldName: 'Name',
|
||||
description: '',
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
width: 15,
|
||||
),
|
||||
DateTimeWebWidget(
|
||||
icon: Assets.calendarIcon,
|
||||
isRequired: false,
|
||||
title: 'Access Time',
|
||||
size: size,
|
||||
endTime: () {
|
||||
accessBloc.add(SelectTime(context: context, isStart: false));
|
||||
},
|
||||
startTime: () {
|
||||
accessBloc.add(SelectTime(context: context, isStart: true));
|
||||
},
|
||||
firstString:BlocProvider.of<AccessBloc>(context).startTime ,
|
||||
secondString:BlocProvider.of<AccessBloc>(context).endTime ,
|
||||
) ,
|
||||
const SizedBox(
|
||||
width: 15,
|
||||
),
|
||||
|
||||
SizedBox(
|
||||
|
||||
width: size.width * 0.06,
|
||||
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(
|
||||
width: size.width * 0.06,
|
||||
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),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(
|
||||
width: 10,
|
||||
height: 20,
|
||||
),
|
||||
Container(
|
||||
width: size.width * 0.12,
|
||||
decoration: containerDecoration,
|
||||
child: DefaultButton(
|
||||
borderRadius: 8,
|
||||
backgroundColor: ColorsManager.whiteColors,
|
||||
child: Text(
|
||||
'Admin Password',
|
||||
style: Theme.of(context)
|
||||
.textTheme
|
||||
.bodySmall!
|
||||
.copyWith(color: Colors.black),
|
||||
)))
|
||||
Wrap(
|
||||
children: [
|
||||
Container(
|
||||
width: size.width * 0.15,
|
||||
decoration: containerDecoration,
|
||||
child: DefaultButton(
|
||||
onPressed: () {
|
||||
showDialog(
|
||||
context: context,
|
||||
barrierDismissible: false,
|
||||
builder: (BuildContext context) {
|
||||
return const VisitorPasswordDialog();
|
||||
},
|
||||
).then((v){
|
||||
if(v!=null){
|
||||
accessBloc.add(FetchTableData());
|
||||
}
|
||||
});
|
||||
},
|
||||
borderRadius: 8,
|
||||
child: const Text('+ Create Visitor Password ')),
|
||||
),
|
||||
const SizedBox(
|
||||
width: 10,
|
||||
),
|
||||
Container(
|
||||
width: size.width * 0.12,
|
||||
decoration: containerDecoration,
|
||||
child: DefaultButton(
|
||||
borderRadius: 8,
|
||||
backgroundColor: ColorsManager.whiteColors,
|
||||
child: Text(
|
||||
'Admin Password',
|
||||
style: Theme.of(context)
|
||||
.textTheme
|
||||
.bodySmall!
|
||||
.copyWith(color: Colors.black),
|
||||
)))
|
||||
],
|
||||
),
|
||||
const SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
Expanded(
|
||||
child: DynamicTable(
|
||||
isEmpty: filteredData.isEmpty ,
|
||||
withCheckBox: false,
|
||||
size: size,
|
||||
cellDecoration: containerDecoration,
|
||||
headers: const [
|
||||
'Name',
|
||||
'Access Type',
|
||||
'Access Period',
|
||||
'Accessible Device',
|
||||
'Authorizer',
|
||||
'Authorization Date & Time',
|
||||
'Access Status'
|
||||
],
|
||||
data: filteredData.map((item) {
|
||||
|
||||
return [
|
||||
item.passwordName.toString(),
|
||||
item.passwordType.value,
|
||||
('${accessBloc.timestampToDate(item.effectiveTime)} - ${accessBloc.timestampToDate(item.invalidTime)}'),
|
||||
item.deviceUuid.toString(),
|
||||
'',
|
||||
'',
|
||||
item.passwordStatus.value,
|
||||
];
|
||||
}).toList(),
|
||||
)
|
||||
// : const Center(child: CircularProgressIndicator()),
|
||||
)
|
||||
],
|
||||
),
|
||||
const SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
Expanded(
|
||||
child: DynamicTable(
|
||||
isEmpty: filteredData.isEmpty ,
|
||||
withCheckBox: false,
|
||||
size: size,
|
||||
cellDecoration: containerDecoration,
|
||||
headers: const [
|
||||
'Name',
|
||||
'Access Type',
|
||||
'Access Period',
|
||||
'Accessible Device',
|
||||
'Authorizer',
|
||||
'Authorization Date & Time',
|
||||
'Access Status'
|
||||
],
|
||||
data: filteredData.map((item) {
|
||||
|
||||
return [
|
||||
item.passwordName.toString(),
|
||||
item.passwordType.value,
|
||||
('${accessBloc.timestampToDate(item.effectiveTime)} - ${accessBloc.timestampToDate(item.invalidTime)}'),
|
||||
item.deviceUuid.toString(),
|
||||
'',
|
||||
'',
|
||||
item.passwordStatus.value,
|
||||
];
|
||||
}).toList(),
|
||||
)
|
||||
// : const Center(child: CircularProgressIndicator()),
|
||||
)
|
||||
],
|
||||
),
|
||||
);
|
||||
})));
|
||||
);
|
||||
}))
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -4,6 +4,7 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:flutter_svg/svg.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:syncrow_web/pages/auth/bloc/auth_bloc.dart';
|
||||
import 'package:syncrow_web/pages/auth/bloc/auth_event.dart';
|
||||
import 'package:syncrow_web/pages/auth/bloc/auth_state.dart';
|
||||
@ -13,7 +14,7 @@ import 'package:syncrow_web/pages/common/default_button.dart';
|
||||
import 'package:syncrow_web/pages/common/first_layer.dart';
|
||||
import 'package:syncrow_web/utils/color_manager.dart';
|
||||
import 'package:syncrow_web/utils/constants/assets.dart';
|
||||
import 'package:syncrow_web/pages/home/view/home_page.dart';
|
||||
import 'package:syncrow_web/utils/constants/routes_const.dart';
|
||||
import 'package:syncrow_web/utils/style.dart';
|
||||
|
||||
class LoginWebPage extends StatefulWidget {
|
||||
@ -33,13 +34,8 @@ class _LoginWebPageState extends State<LoginWebPage> {
|
||||
child: BlocConsumer<AuthBloc, AuthState>(
|
||||
listener: (context, state) {
|
||||
if (state is LoginSuccess) {
|
||||
// Navigate to home screen after successful login
|
||||
Navigator.pushReplacement(
|
||||
context,
|
||||
MaterialPageRoute(builder: (context) => HomePage()),
|
||||
);
|
||||
context.pushReplacement(RoutesConst.home);
|
||||
} else if (state is LoginFailure) {
|
||||
// Show error message
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text(state.error),
|
||||
|
@ -2,15 +2,18 @@ import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:graphview/GraphView.dart';
|
||||
import 'package:syncrow_web/pages/access_management/view/access_management.dart';
|
||||
import 'package:syncrow_web/pages/auth/model/user_model.dart';
|
||||
import 'package:syncrow_web/pages/home/bloc/home_event.dart';
|
||||
import 'package:syncrow_web/pages/home/bloc/home_state.dart';
|
||||
import 'package:syncrow_web/pages/home/home_model/home_item_model.dart';
|
||||
import 'package:syncrow_web/pages/spaseManagementIcon.dart';
|
||||
import 'package:syncrow_web/services/home_api.dart';
|
||||
import 'package:syncrow_web/utils/color_manager.dart';
|
||||
import 'package:syncrow_web/utils/constants/assets.dart';
|
||||
import 'package:syncrow_web/utils/constants/routes_const.dart';
|
||||
|
||||
class HomeBloc extends Bloc<HomeEvent, HomeState> {
|
||||
final Graph graph = Graph()..isTree = true;
|
||||
@ -60,9 +63,7 @@ class HomeBloc extends Bloc<HomeEvent, HomeState> {
|
||||
icon: Assets.accessIcon,
|
||||
active: true,
|
||||
onPress: (context) {
|
||||
Navigator.of(context).push(
|
||||
MaterialPageRoute(builder: (context) => AccessManagementPage()),
|
||||
);
|
||||
context.go(RoutesConst.accessManagementPage);
|
||||
},
|
||||
color: null,
|
||||
),
|
||||
@ -71,6 +72,7 @@ class HomeBloc extends Bloc<HomeEvent, HomeState> {
|
||||
icon: Assets.spaseManagementIcon,
|
||||
active: true,
|
||||
onPress: (context) {
|
||||
|
||||
},
|
||||
color: ColorsManager.primaryColor,
|
||||
),
|
||||
|
@ -8,9 +8,11 @@ class HomePage extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ResponsiveLayout(
|
||||
return
|
||||
|
||||
ResponsiveLayout(
|
||||
desktopBody: HomeWebPage(),
|
||||
mobileBody:HomeMobilePage()
|
||||
);
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -12,7 +12,11 @@ class HomeWebPage extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
Size size = MediaQuery.of(context).size;
|
||||
return WebScaffold(
|
||||
return PopScope(
|
||||
canPop: false,
|
||||
onPopInvoked: (didPop) => false,
|
||||
child:
|
||||
WebScaffold(
|
||||
enableMenuSideba: false,
|
||||
appBarTitle: Row(
|
||||
children: [
|
||||
@ -74,6 +78,6 @@ class HomeWebPage extends StatelessWidget {
|
||||
);
|
||||
},
|
||||
),
|
||||
));
|
||||
)));
|
||||
}
|
||||
}
|
||||
|
16
lib/pages/spaseManagementIcon.dart
Normal file
16
lib/pages/spaseManagementIcon.dart
Normal file
@ -0,0 +1,16 @@
|
||||
|
||||
|
||||
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class SpaseManagementicon extends StatelessWidget {
|
||||
const SpaseManagementicon({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
body: Container(),
|
||||
);
|
||||
}
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
|
||||
|
||||
import 'package:syncrow_web/utils/constants/const.dart';
|
||||
import 'package:syncrow_web/utils/constants/app_enum.dart';
|
||||
|
||||
class DeviceModel {
|
||||
dynamic productUuid;
|
||||
|
@ -9,7 +9,7 @@ import 'package:syncrow_web/pages/visitor_password/bloc/visitor_password_event.d
|
||||
import 'package:syncrow_web/pages/visitor_password/bloc/visitor_password_state.dart';
|
||||
import 'package:syncrow_web/utils/color_manager.dart';
|
||||
import 'package:syncrow_web/utils/constants/assets.dart';
|
||||
import 'package:syncrow_web/utils/constants/const.dart';
|
||||
import 'package:syncrow_web/utils/constants/app_enum.dart';
|
||||
import 'package:syncrow_web/utils/style.dart';
|
||||
|
||||
class AddDeviceDialog extends StatelessWidget {
|
||||
|
@ -43,10 +43,11 @@ class AuthenticationAPI {
|
||||
},
|
||||
showServerMessage: true,
|
||||
expectedResponseModel: (json) {
|
||||
return 30;
|
||||
return json['data']['cooldown'];
|
||||
}
|
||||
);
|
||||
return 30;
|
||||
|
||||
return response;
|
||||
} on DioException catch (e) {
|
||||
if (e.response != null) {
|
||||
if (e.response!.statusCode == 400) {
|
||||
|
33
lib/utils/app_routes.dart
Normal file
33
lib/utils/app_routes.dart
Normal file
@ -0,0 +1,33 @@
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:syncrow_web/pages/access_management/view/access_management.dart';
|
||||
import 'package:syncrow_web/pages/auth/view/login_page.dart';
|
||||
import 'package:syncrow_web/pages/home/view/home_page.dart';
|
||||
import 'package:syncrow_web/pages/visitor_password/view/visitor_password_dialog.dart';
|
||||
import 'package:syncrow_web/utils/constants/routes_const.dart';
|
||||
|
||||
class AppRoutes {
|
||||
static List<GoRoute> getRoutes() {
|
||||
return [
|
||||
GoRoute(
|
||||
path:RoutesConst.main,
|
||||
builder: (context, state) => const LoginPage(),
|
||||
),
|
||||
|
||||
GoRoute(
|
||||
path: RoutesConst.home,
|
||||
builder: (context, state) => const HomePage(),
|
||||
),
|
||||
|
||||
GoRoute(
|
||||
path: RoutesConst.visitorPassword,
|
||||
builder: (context, state) => const VisitorPasswordDialog(),
|
||||
),
|
||||
|
||||
GoRoute(
|
||||
path: RoutesConst.accessManagementPage ,
|
||||
builder: (context, state) => const AccessManagementPage(),
|
||||
),
|
||||
|
||||
];
|
||||
}
|
||||
}
|
@ -27,4 +27,5 @@ class Assets {
|
||||
static const String deviceNoteIcon = "assets/images/device_note.svg";
|
||||
static const String timeIcon = "assets/images/time_icon.svg";
|
||||
static const String emptyTable = "assets/images/empty_table.svg";
|
||||
static const String grid = "assets/images/grid.svg";
|
||||
}
|
||||
|
6
lib/utils/constants/routes_const.dart
Normal file
6
lib/utils/constants/routes_const.dart
Normal file
@ -0,0 +1,6 @@
|
||||
class RoutesConst {
|
||||
static const String main = '/';
|
||||
static const String home = '/home';
|
||||
static const String visitorPassword = '/visitor-password';
|
||||
static const String accessManagementPage = '/access-management-page';
|
||||
}
|
@ -5,3 +5,6 @@ class NavigationService {
|
||||
static GlobalKey<ScaffoldMessengerState>? snackbarKey =
|
||||
GlobalKey<ScaffoldMessengerState>();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
16
pubspec.lock
16
pubspec.lock
@ -216,6 +216,14 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "7.7.0"
|
||||
go_router:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: go_router
|
||||
sha256: "2ddb88e9ad56ae15ee144ed10e33886777eb5ca2509a914850a5faa7b52ff459"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "14.2.7"
|
||||
graphview:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
@ -288,6 +296,14 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "3.0.0"
|
||||
logging:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: logging
|
||||
sha256: "623a88c9594aa774443aa3eb2d41807a48486b5613e67599fb4c41c0ad47c340"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.2.0"
|
||||
matcher:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
@ -44,7 +44,9 @@ dependencies:
|
||||
flutter_secure_storage: ^9.2.2
|
||||
shared_preferences: ^2.3.0
|
||||
data_table_2: ^2.5.15
|
||||
go_router:
|
||||
intl: ^0.19.0
|
||||
|
||||
dev_dependencies:
|
||||
flutter_test:
|
||||
sdk: flutter
|
||||
|
Reference in New Issue
Block a user