From 4bb7e0ac727408c1e3aea6a9f0413579b07271f3 Mon Sep 17 00:00:00 2001 From: risadmin_prod Date: Sat, 20 Sep 2025 04:21:17 +0000 Subject: [PATCH] build_app --- .../authsec_mysql/mysql/wf_table/wf_table.sql | 6 + .../Child/ChildView/Child_api_service.dart | 76 ++ .../ChildView/Child_create_entity_screen.dart | 78 ++ .../Child/ChildView/Child_details_screen.dart | 86 ++ .../ChildView/Child_entity_list_screen.dart | 148 ++ .../basic1/Child/ChildView/Child_fields.dart | 63 + .../ChildView/Child_update_entity_screen.dart | 73 + .../Child/Child_Repo/Child_repo_screen.dart | 91 ++ .../Child_view_model_screen.dart | 276 ++++ .../TestbugView/Testbug_api_service.dart | 112 ++ .../Testbug_create_entity_screen.dart | 96 ++ .../TestbugView/Testbug_details_screen.dart | 104 ++ .../Testbug_entity_list_screen.dart | 164 +++ .../Testbug/TestbugView/Testbug_fields.dart | 210 +++ .../Testbug_update_entity_screen.dart | 91 ++ .../Testbug_Repo/Testbug_repo_screen.dart | 158 +++ .../Testbug_view_model_screen.dart | 590 ++++++++ .../TestlistView/Testlist_api_service.dart | 84 ++ .../Testlist_create_entity_screen.dart | 82 ++ .../TestlistView/Testlist_details_screen.dart | 90 ++ .../Testlist_entity_list_screen.dart | 150 +++ .../TestlistView/Testlist_fields.dart | 76 ++ .../Testlist_update_entity_screen.dart | 77 ++ .../Testlist_Repo/Testlist_repo_screen.dart | 95 ++ .../Testlist_view_model_screen.dart | 305 +++++ .../base_project/lib/view/dashboard/home.dart | 1198 +++++++++-------- .../Builders/Services/BuilderService.java | 9 + .../basic1/Controllers/ChildController.java | 83 ++ .../basic1/Controllers/TestbugController.java | 155 +++ .../Controllers/TestlistController.java | 99 ++ .../Testlist_ListFilter1Controller.java | 24 + .../tokenFree_ChildController.java | 83 ++ .../tokenFree_TestbugController.java | 155 +++ .../tokenFree_TestlistController.java | 99 ++ ...enFree_Testlist_ListFilter1Controller.java | 24 + .../java/com/realnet/basic1/Entity/Child.java | 24 + .../com/realnet/basic1/Entity/Testbug.java | 75 ++ .../com/realnet/basic1/Entity/Testlist.java | 33 + .../basic1/Entity/Testlist_ListFilter1.java | 14 + .../basic1/Repository/ChildRepository.java | 26 + .../basic1/Repository/TestbugRepository.java | 44 + .../basic1/Repository/TestlistRepository.java | 30 + .../realnet/basic1/Services/ChildService.java | 73 + .../basic1/Services/TestbugService.java | 219 +++ .../basic1/Services/TestlistService.java | 93 ++ .../Services/Testlist_ListFilter1Service.java | 51 + 46 files changed, 5413 insertions(+), 579 deletions(-) create mode 100755 testflutterbugdt-dbtdt-d/authsec_mysql/mysql/wf_table/wf_table.sql create mode 100644 testflutterbugdt-demot1-f/authsec_flutter_new/base_project/lib/Entity/basic1/Child/ChildView/Child_api_service.dart create mode 100644 testflutterbugdt-demot1-f/authsec_flutter_new/base_project/lib/Entity/basic1/Child/ChildView/Child_create_entity_screen.dart create mode 100644 testflutterbugdt-demot1-f/authsec_flutter_new/base_project/lib/Entity/basic1/Child/ChildView/Child_details_screen.dart create mode 100644 testflutterbugdt-demot1-f/authsec_flutter_new/base_project/lib/Entity/basic1/Child/ChildView/Child_entity_list_screen.dart create mode 100644 testflutterbugdt-demot1-f/authsec_flutter_new/base_project/lib/Entity/basic1/Child/ChildView/Child_fields.dart create mode 100644 testflutterbugdt-demot1-f/authsec_flutter_new/base_project/lib/Entity/basic1/Child/ChildView/Child_update_entity_screen.dart create mode 100644 testflutterbugdt-demot1-f/authsec_flutter_new/base_project/lib/Entity/basic1/Child/Child_Repo/Child_repo_screen.dart create mode 100644 testflutterbugdt-demot1-f/authsec_flutter_new/base_project/lib/Entity/basic1/Child/Child_viewModel/Child_view_model_screen.dart create mode 100644 testflutterbugdt-demot1-f/authsec_flutter_new/base_project/lib/Entity/basic1/Testbug/TestbugView/Testbug_api_service.dart create mode 100644 testflutterbugdt-demot1-f/authsec_flutter_new/base_project/lib/Entity/basic1/Testbug/TestbugView/Testbug_create_entity_screen.dart create mode 100644 testflutterbugdt-demot1-f/authsec_flutter_new/base_project/lib/Entity/basic1/Testbug/TestbugView/Testbug_details_screen.dart create mode 100644 testflutterbugdt-demot1-f/authsec_flutter_new/base_project/lib/Entity/basic1/Testbug/TestbugView/Testbug_entity_list_screen.dart create mode 100644 testflutterbugdt-demot1-f/authsec_flutter_new/base_project/lib/Entity/basic1/Testbug/TestbugView/Testbug_fields.dart create mode 100644 testflutterbugdt-demot1-f/authsec_flutter_new/base_project/lib/Entity/basic1/Testbug/TestbugView/Testbug_update_entity_screen.dart create mode 100644 testflutterbugdt-demot1-f/authsec_flutter_new/base_project/lib/Entity/basic1/Testbug/Testbug_Repo/Testbug_repo_screen.dart create mode 100644 testflutterbugdt-demot1-f/authsec_flutter_new/base_project/lib/Entity/basic1/Testbug/Testbug_viewModel/Testbug_view_model_screen.dart create mode 100644 testflutterbugdt-demot1-f/authsec_flutter_new/base_project/lib/Entity/basic1/Testlist/TestlistView/Testlist_api_service.dart create mode 100644 testflutterbugdt-demot1-f/authsec_flutter_new/base_project/lib/Entity/basic1/Testlist/TestlistView/Testlist_create_entity_screen.dart create mode 100644 testflutterbugdt-demot1-f/authsec_flutter_new/base_project/lib/Entity/basic1/Testlist/TestlistView/Testlist_details_screen.dart create mode 100644 testflutterbugdt-demot1-f/authsec_flutter_new/base_project/lib/Entity/basic1/Testlist/TestlistView/Testlist_entity_list_screen.dart create mode 100644 testflutterbugdt-demot1-f/authsec_flutter_new/base_project/lib/Entity/basic1/Testlist/TestlistView/Testlist_fields.dart create mode 100644 testflutterbugdt-demot1-f/authsec_flutter_new/base_project/lib/Entity/basic1/Testlist/TestlistView/Testlist_update_entity_screen.dart create mode 100644 testflutterbugdt-demot1-f/authsec_flutter_new/base_project/lib/Entity/basic1/Testlist/Testlist_Repo/Testlist_repo_screen.dart create mode 100644 testflutterbugdt-demot1-f/authsec_flutter_new/base_project/lib/Entity/basic1/Testlist/Testlist_viewModel/Testlist_view_model_screen.dart create mode 100644 testflutterbugdt-test2-b/authsec_springboot/backend/src/main/java/com/realnet/basic1/Controllers/ChildController.java create mode 100644 testflutterbugdt-test2-b/authsec_springboot/backend/src/main/java/com/realnet/basic1/Controllers/TestbugController.java create mode 100644 testflutterbugdt-test2-b/authsec_springboot/backend/src/main/java/com/realnet/basic1/Controllers/TestlistController.java create mode 100644 testflutterbugdt-test2-b/authsec_springboot/backend/src/main/java/com/realnet/basic1/Controllers/Testlist_ListFilter1Controller.java create mode 100644 testflutterbugdt-test2-b/authsec_springboot/backend/src/main/java/com/realnet/basic1/Controllers/tokenFree_ChildController.java create mode 100644 testflutterbugdt-test2-b/authsec_springboot/backend/src/main/java/com/realnet/basic1/Controllers/tokenFree_TestbugController.java create mode 100644 testflutterbugdt-test2-b/authsec_springboot/backend/src/main/java/com/realnet/basic1/Controllers/tokenFree_TestlistController.java create mode 100644 testflutterbugdt-test2-b/authsec_springboot/backend/src/main/java/com/realnet/basic1/Controllers/tokenFree_Testlist_ListFilter1Controller.java create mode 100644 testflutterbugdt-test2-b/authsec_springboot/backend/src/main/java/com/realnet/basic1/Entity/Child.java create mode 100644 testflutterbugdt-test2-b/authsec_springboot/backend/src/main/java/com/realnet/basic1/Entity/Testbug.java create mode 100644 testflutterbugdt-test2-b/authsec_springboot/backend/src/main/java/com/realnet/basic1/Entity/Testlist.java create mode 100644 testflutterbugdt-test2-b/authsec_springboot/backend/src/main/java/com/realnet/basic1/Entity/Testlist_ListFilter1.java create mode 100644 testflutterbugdt-test2-b/authsec_springboot/backend/src/main/java/com/realnet/basic1/Repository/ChildRepository.java create mode 100644 testflutterbugdt-test2-b/authsec_springboot/backend/src/main/java/com/realnet/basic1/Repository/TestbugRepository.java create mode 100644 testflutterbugdt-test2-b/authsec_springboot/backend/src/main/java/com/realnet/basic1/Repository/TestlistRepository.java create mode 100644 testflutterbugdt-test2-b/authsec_springboot/backend/src/main/java/com/realnet/basic1/Services/ChildService.java create mode 100644 testflutterbugdt-test2-b/authsec_springboot/backend/src/main/java/com/realnet/basic1/Services/TestbugService.java create mode 100644 testflutterbugdt-test2-b/authsec_springboot/backend/src/main/java/com/realnet/basic1/Services/TestlistService.java create mode 100644 testflutterbugdt-test2-b/authsec_springboot/backend/src/main/java/com/realnet/basic1/Services/Testlist_ListFilter1Service.java diff --git a/testflutterbugdt-dbtdt-d/authsec_mysql/mysql/wf_table/wf_table.sql b/testflutterbugdt-dbtdt-d/authsec_mysql/mysql/wf_table/wf_table.sql new file mode 100755 index 0000000..0b7bec6 --- /dev/null +++ b/testflutterbugdt-dbtdt-d/authsec_mysql/mysql/wf_table/wf_table.sql @@ -0,0 +1,6 @@ +CREATE TABLE dbtdt.Testbug(id BIGINT NOT NULL AUTO_INCREMENT, select_dynamic_mul VARCHAR(400), onetoone VARCHAR(400), select_autocomp int, select_autcomp_mul VARCHAR(400), fileupload_fields VARCHAR(400), bar_code VARCHAR(400), qr_code VARCHAR(400), value_list_fieldcc VARCHAR(400), datagrid_fieldv VARCHAR(400), select_dyanamic int, name VARCHAR(400), PRIMARY KEY (id)); + +CREATE TABLE dbtdt.Child(id BIGINT NOT NULL AUTO_INCREMENT, namek VARCHAR(400), PRIMARY KEY (id)); + +CREATE TABLE dbtdt.Testlist(id BIGINT NOT NULL AUTO_INCREMENT, active VARCHAR(400), description VARCHAR(400), name VARCHAR(400), PRIMARY KEY (id)); + diff --git a/testflutterbugdt-demot1-f/authsec_flutter_new/base_project/lib/Entity/basic1/Child/ChildView/Child_api_service.dart b/testflutterbugdt-demot1-f/authsec_flutter_new/base_project/lib/Entity/basic1/Child/ChildView/Child_api_service.dart new file mode 100644 index 0000000..f3913ea --- /dev/null +++ b/testflutterbugdt-demot1-f/authsec_flutter_new/base_project/lib/Entity/basic1/Child/ChildView/Child_api_service.dart @@ -0,0 +1,76 @@ +import 'dart:typed_data'; +import 'package:dio/dio.dart'; +import 'package:http_parser/http_parser.dart'; +import '../../../../resources/api_constants.dart'; +import '../../../../data/network/base_network_service.dart'; +import '../../../../data/network/network_api_service.dart'; + +class ChildApiService { + final String baseUrl = ApiConstants.baseUrl; + + final BaseNetworkService _helper = NetworkApiService(); + + + + Future>> getEntities() async { + + try { + final response = await _helper.getGetApiResponse('$baseUrl/Child/Child'); + final entities = (response as List).cast>(); + return entities; + } catch (e) { + throw Exception('Failed to get all entities: $e'); + } + } +Future>> getAllWithPagination( + int page, int size) async { + try { + final response = + await _helper.getGetApiResponse('$baseUrl/Child/Child/getall/page?page=$page&size=$size'); + final entities = + (response['content'] as List).cast>(); + return entities; + } catch (e) { + throw Exception('Failed to get all without pagination: $e'); + } + } + Future> createEntity( + Map entity) async { + try { + print("in post api$entity"); + final response = + await _helper.getPostApiResponse('$baseUrl/Child/Child', entity); + + print(entity); + + // Assuming the response is a Map + Map responseData = response; + + return responseData; + } catch (e) { + throw Exception('Failed to create entity: $e'); + } + } + + + + Future updateEntity( int entityId, Map entity) async { + try { + await _helper.getPutApiResponse('$baseUrl/Child/Child/$entityId', + entity); print(entity); + + } catch (e) { + throw Exception('Failed to update entity: $e'); + } + } + + Future deleteEntity( int entityId) async { + try { + await _helper.getDeleteApiResponse('$baseUrl/Child/Child/$entityId'); + } catch (e) { + throw Exception('Failed to delete entity: $e'); + } + } + + +} \ No newline at end of file diff --git a/testflutterbugdt-demot1-f/authsec_flutter_new/base_project/lib/Entity/basic1/Child/ChildView/Child_create_entity_screen.dart b/testflutterbugdt-demot1-f/authsec_flutter_new/base_project/lib/Entity/basic1/Child/ChildView/Child_create_entity_screen.dart new file mode 100644 index 0000000..149e502 --- /dev/null +++ b/testflutterbugdt-demot1-f/authsec_flutter_new/base_project/lib/Entity/basic1/Child/ChildView/Child_create_entity_screen.dart @@ -0,0 +1,78 @@ +// ignore_for_file: use_build_context_synchronously +import 'dart:convert'; +import 'package:flutter/material.dart'; +import 'package:file_picker/file_picker.dart'; +import 'package:image_picker/image_picker.dart'; +import 'package:provider/provider.dart'; +import '../Child_viewModel/Child_view_model_screen.dart'; +import 'Child_fields.dart';import 'package:base_project/BuilderField/shared/ui/entity_screens.dart'; +import '../../../../utils/image_constant.dart'; +import '../../../../utils/size_utils.dart'; +import '../../../../theme/app_style.dart'; +import '../../../../widgets/app_bar/appbar_image.dart'; +import '../../../../widgets/app_bar/appbar_title.dart'; +import '../../../../widgets/app_bar/custom_app_bar.dart'; +import '../../../../widgets/custom_button.dart'; +import '../../../../widgets/custom_text_form_field.dart'; +import '../../../../widgets/custom_dropdown_field.dart'; +import 'dart:math'; +import 'package:qr_flutter/qr_flutter.dart'; +import 'package:barcode_widget/barcode_widget.dart'; +import 'package:intl/intl.dart'; + +import 'package:autocomplete_textfield/autocomplete_textfield.dart'; +import 'package:http/http.dart' as http; +import 'package:flutter/services.dart'; +import 'package:image_picker/image_picker.dart'; +import 'package:fluttertoast/fluttertoast.dart'; +import '../../../../Reuseable/reusable_date_picker_field.dart'; +import '../../../../Reuseable/reusable_date_time_picker_field.dart' +;import 'package:multi_select_flutter/multi_select_flutter.dart'; +import 'package:just_audio/just_audio.dart'; +import 'package:video_player/video_player.dart'; +import 'package:google_fonts/google_fonts.dart'; +import 'package:lottie/lottie.dart'; +import '../../../../utils/toast_messages/toast_message_util.dart'; +import 'dart:io'; +import '../../../../Reuseable/reusable_text_field.dart'; +import '../../../../Reuseable/reusable_dropdown_field.dart'; + + +class ChildCreateEntityScreen extends StatefulWidget { + const ChildCreateEntityScreen({super.key}); + + @override + _ChildCreateEntityScreenState createState() => _ChildCreateEntityScreenState(); +} + +class _ChildCreateEntityScreenState extends State { + +final Map formData = {}; + final _formKey = GlobalKey(); + + @override + Widget build(BuildContext context) { + return Consumer( + builder: (context, viewModel, child) { + return EntityCreateScreen( + fields: ChildFields.getFields(context), + onSubmit: (data) => _handleSubmit(data), + title: 'Child', + isLoading: viewModel.isLoading, + errorMessage: + viewModel.errorMessage.isNotEmpty ? viewModel.errorMessage : null, + ); + }, + ); + } + + Future _handleSubmit(Map formData) async { + final provider = + Provider.of(context, listen: false); + final success = await provider.createEntity(formData); + + if (success && mounted) { + Navigator.pop(context); + } + } +} \ No newline at end of file diff --git a/testflutterbugdt-demot1-f/authsec_flutter_new/base_project/lib/Entity/basic1/Child/ChildView/Child_details_screen.dart b/testflutterbugdt-demot1-f/authsec_flutter_new/base_project/lib/Entity/basic1/Child/ChildView/Child_details_screen.dart new file mode 100644 index 0000000..5578d73 --- /dev/null +++ b/testflutterbugdt-demot1-f/authsec_flutter_new/base_project/lib/Entity/basic1/Child/ChildView/Child_details_screen.dart @@ -0,0 +1,86 @@ +// ignore_for_file: use_build_context_synchronously +import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; +import '../../../../BuilderField/shared/ui/entity_details.dart'; +import '../Child_viewModel/Child_view_model_screen.dart'; +import 'Child_update_entity_screen.dart'; + +class ChildDetailsScreen extends StatefulWidget { + final Map entity; + + const ChildDetailsScreen({ + super.key, + required this.entity, + }); + + @override + State createState() => _ChildDetailsScreenState(); +} + +class _ChildDetailsScreenState extends State { + void _navigateToUpdateScreen(Map entity) { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => ChangeNotifierProvider( + create: (context) => ChildViewModelScreen(), + child: ChildUpdateEntityScreen(entity: entity), + ), + ), + ).then((_) { + // Refresh the details screen with updated data + setState(() {}); + }); + } + + void _showDeleteDialog(Map entity) { + showDialog( + context: context, + builder: (BuildContext context) { + return AlertDialog( + title: const Text('Confirm Deletion'), + content: const Text('Are you sure you want to delete this Child?'), + actions: [ + TextButton( + child: const Text('Cancel'), + onPressed: () { + Navigator.of(context).pop(); + }, + ), + TextButton( + child: const Text('Delete'), + onPressed: () async { + Navigator.of(context).pop(); + final vm = + Provider.of(context, listen: false); + final success = await vm.deleteEntity(entity['id']); + if (success && mounted) { + Navigator.pop(context); // Go back to list + } + }, + ), + ], + ); + }, + ); + } + + @override + Widget build(BuildContext context) { + return Consumer( + builder: (context, viewModel, child) { + return EntityDetails( + entity: widget.entity, + onEdit: (entity) => _navigateToUpdateScreen(entity), + onDelete: (entity) => _showDeleteDialog(entity), + title: 'Child', + displayFields: [ + {'key': 'namek', 'label': 'Namek', 'type': 'text'}, + + ], + isLoading: viewModel.isLoading, + ); + }, + ); + } +} diff --git a/testflutterbugdt-demot1-f/authsec_flutter_new/base_project/lib/Entity/basic1/Child/ChildView/Child_entity_list_screen.dart b/testflutterbugdt-demot1-f/authsec_flutter_new/base_project/lib/Entity/basic1/Child/ChildView/Child_entity_list_screen.dart new file mode 100644 index 0000000..6bc82f7 --- /dev/null +++ b/testflutterbugdt-demot1-f/authsec_flutter_new/base_project/lib/Entity/basic1/Child/ChildView/Child_entity_list_screen.dart @@ -0,0 +1,148 @@ +// ignore_for_file: use_build_context_synchronously +import 'package:flutter/material.dart'; +import 'package:intl/intl.dart'; +import 'package:base_project/BuilderField/shared/ui/entity_list.dart'; +import 'Child_create_entity_screen.dart'; +import 'Child_update_entity_screen.dart'; +import '../Child_viewModel/Child_view_model_screen.dart'; +import 'Child_details_screen.dart';import 'package:flutter/services.dart'; +import 'package:speech_to_text/speech_to_text.dart' as stt; +import '../../../../theme/app_style.dart'; +import '../../../../utils/size_utils.dart'; +import '../../../../widgets/custom_icon_button.dart'; +import '../../../../utils/image_constant.dart'; +import '../../../../widgets/app_bar/appbar_image.dart'; +import '../../../../widgets/app_bar/appbar_title.dart'; +import '../../../../widgets/app_bar/custom_app_bar.dart'; +import '../../../../theme/app_decoration.dart'; +import 'package:multi_select_flutter/multi_select_flutter.dart'; +import '../../../../Reuseable/reusable_text_field.dart'; +import 'package:provider/provider.dart'; +import '../../../../utils/toast_messages/toast_message_util.dart'; +import 'package:fluttertoast/fluttertoast.dart'; + +class Child_entity_list_screen extends StatefulWidget { + final Map tabEntity; + const Child_entity_list_screen({required this.tabEntity, Key? key}) + : super(key: key); static const String routeName = '/entity-list'; + + @override + _Child_entity_list_screenState createState() => _Child_entity_list_screenState(); +} + +class _Child_entity_list_screenState extends State { + @override + void initState() { + super.initState(); + _loadData(); + } + + void _loadData() { + WidgetsBinding.instance.addPostFrameCallback((_) { + if (mounted) { + final vm = Provider.of(context, listen: false); + vm.getAllWithPagination(refresh: true); + } + }); + } + + void _navigateToCreateScreen() { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => ChangeNotifierProvider( + create: (context) => ChildViewModelScreen(), + child: const ChildCreateEntityScreen(), + ), + ), + ).then((_) { + final vm = Provider.of(context, listen: false); + vm.refreshData(); + }); + } + + void _navigateToUpdateScreen(Map entity) { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => ChangeNotifierProvider( + create: (context) => ChildViewModelScreen(), + child: ChildUpdateEntityScreen(entity: entity), + ), + ), + ).then((_) { + final vm = Provider.of(context, listen: false); + vm.refreshData(); + }); + } + + void _navigateToDetailsScreen(Map entity) { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => ChangeNotifierProvider( + create: (context) => ChildViewModelScreen(), + child: ChildDetailsScreen(entity: entity), + ), + ), + ); + } + + void _showDeleteDialog(Map entity) { + final parentContext = context; + showDialog( + context: context, + builder: (BuildContext context) { + return AlertDialog( + title: const Text('Confirm Deletion'), + content: const Text('Are you sure you want to delete this Child?'), + actions: [ + TextButton( + child: const Text('Cancel'), + onPressed: () { + Navigator.of(context).pop(); + }, + ), + TextButton( + child: const Text('Delete'), + onPressed: () async { + Navigator.of(context).pop(); + final vm = + Provider.of(parentContext, listen: false); + await vm.deleteEntity(entity['id']); + }, + ), + ], + ); + }, + ); + } + + @override + Widget build(BuildContext context) { + return Consumer( + builder: (context, viewModel, child) { + return EntityList( + entities: viewModel.filteredList, + isLoading: viewModel.isLoading, + errorMessage: + viewModel.errorMessage.isNotEmpty ? viewModel.errorMessage : null, + hasMoreData: viewModel.hasMoreData, + searchQuery: viewModel.searchQuery, + onSearchChanged: (query) => viewModel.searchchild(query), + onEdit: (entity) => _navigateToUpdateScreen(entity), + onDelete: (entity) => _showDeleteDialog(entity), + onTap: (entity) => _navigateToDetailsScreen(entity), + onRefresh: () => viewModel.refreshData(), + onLoadMore: () => viewModel.getAllWithPagination(), + title: 'Child', + onAddNew: _navigateToCreateScreen, + displayFields: [ + {'key': 'namek', 'label': 'Namek', 'type': 'text'}, + + ], + ); + }, + ); + } +} diff --git a/testflutterbugdt-demot1-f/authsec_flutter_new/base_project/lib/Entity/basic1/Child/ChildView/Child_fields.dart b/testflutterbugdt-demot1-f/authsec_flutter_new/base_project/lib/Entity/basic1/Child/ChildView/Child_fields.dart new file mode 100644 index 0000000..e67e2e1 --- /dev/null +++ b/testflutterbugdt-demot1-f/authsec_flutter_new/base_project/lib/Entity/basic1/Child/ChildView/Child_fields.dart @@ -0,0 +1,63 @@ +import 'package:base_project/BuilderField/shared/fields/number_field.dart'; +import 'package:base_project/BuilderField/shared/fields/password_field.dart'; +import 'package:base_project/BuilderField/shared/fields/phone_field.dart'; +import 'package:base_project/BuilderField/shared/fields/custom_text_field.dart'; + +import '../../../../BuilderField/shared/fields/base_field.dart'; + +import '../../../../BuilderField/shared/fields/date_field.dart'; +import '../../../../BuilderField/shared/fields/datetime_field.dart'; +import '../../../../BuilderField/shared/fields/email_field.dart'; +import 'package:base_project/BuilderField/shared/fields/url_field.dart'; +import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; + +import '../../../../BuilderField/shared/fields/custom_text_field.dart' as shared_text; +import '../../../../BuilderField/shared/fields/one_to_one_relation_field.dart'; +import '../../../../BuilderField/shared/fields/calculated_field.dart'; +import '../../../../BuilderField/shared/fields/one_to_many_field.dart'; +import '../../../../BuilderField/shared/fields/value_list_picker_field.dart'; +import '../../../../BuilderField/shared/fields/captcha_field.dart'; +import '../../../../BuilderField/shared/fields/switch_field.dart'; +import '../../../../BuilderField/shared/fields/url_field.dart'; + +import '../../../../BuilderField/shared/fields/audio_upload_field.dart'; +import '../../../../BuilderField/shared/fields/checkbox_field.dart'; +import '../../../../BuilderField/shared/fields/file_upload_field.dart'; +import '../../../../BuilderField/shared/fields/image_upload_field.dart'; +import '../../../../BuilderField/shared/fields/radio_field.dart'; +import '../../../../BuilderField/shared/fields/video_upload_field.dart'; + +import '../../../../BuilderField/shared/fields/autocomplete_dropdown_field.dart'; +import '../../../../BuilderField/shared/fields/autocomplete_multiselect_field.dart'; +import '../../../../BuilderField/shared/fields/one_to_one_relation_field.dart'; +import '../../../../BuilderField/shared/fields/data_grid_field.dart'; +import '../../../../BuilderField/shared/fields/dropdown_field.dart'; +import '../../../../BuilderField/shared/fields/dynamic_dropdown_field.dart'; +import '../../../../BuilderField/shared/fields/dynamic_multiselect_dropdown_field.dart'; +import '../../../../BuilderField/shared/fields/static_multiselect_field.dart'; +import '../../../../BuilderField/shared/fields/currency_field.dart'; +import '../../../../BuilderField/shared/fields/field_group_field.dart'; +import '../../../../BuilderField/shared/fields/qr_code_field.dart'; +import '../../../../BuilderField/shared/fields/barcode_field.dart'; +import '../../../../BuilderField/shared/fields/dependent_dropdown_field.dart'; + import '../Child_viewModel/Child_view_model_screen.dart';/// Field definitions for Child entity +/// This defines the structure and validation for Child forms +class ChildFields { + /// Get field definitions for Child entity + static List getFields(BuildContext context) { + final viewModel = + Provider.of(context, listen: false); + return [ + // Basic Information + CustomTextField( + fieldKey: 'namek', + label: 'Namek', + hint: 'Enter Namek', + isRequired: true, + maxLength: 50, + ), + + ]; + } +} diff --git a/testflutterbugdt-demot1-f/authsec_flutter_new/base_project/lib/Entity/basic1/Child/ChildView/Child_update_entity_screen.dart b/testflutterbugdt-demot1-f/authsec_flutter_new/base_project/lib/Entity/basic1/Child/ChildView/Child_update_entity_screen.dart new file mode 100644 index 0000000..3ad4fc8 --- /dev/null +++ b/testflutterbugdt-demot1-f/authsec_flutter_new/base_project/lib/Entity/basic1/Child/ChildView/Child_update_entity_screen.dart @@ -0,0 +1,73 @@ +// ignore_for_file: use_build_context_synchronously +import 'dart:convert'; +import 'package:provider/provider.dart'; +import '../Child_viewModel/Child_view_model_screen.dart'; +import 'package:base_project/BuilderField/shared/ui/entity_screens.dart'; +import 'Child_fields.dart';import '../../../../utils/image_constant.dart'; +import '../../../../utils/size_utils.dart'; +import '../../../../theme/app_style.dart'; +import '../../../../widgets/app_bar/appbar_image.dart'; +import '../../../../widgets/app_bar/appbar_title.dart'; +import '../../../../widgets/app_bar/custom_app_bar.dart'; +import 'package:barcode_widget/barcode_widget.dart'; +import 'package:fluttertoast/fluttertoast.dart'; +import '../../../../widgets/custom_button.dart'; +import '../../../../widgets/custom_text_form_field.dart'; +import 'package:flutter/material.dart'; +import 'package:autocomplete_textfield/autocomplete_textfield.dart'; +import 'package:qr_flutter/qr_flutter.dart'; +import 'package:intl/intl.dart'; + +import 'dart:math'; +import '../../../../Reuseable/reusable_text_field.dart'; +import '../../../../Reuseable/reusable_date_picker_field.dart'; +import '../../../../Reuseable/reusable_date_time_picker_field.dart'; +import '../../../../Reuseable/reusable_dropdown_field.dart'; +import 'package:flutter/services.dart'; +class ChildUpdateEntityScreen extends StatefulWidget { + final Map entity; + + + ChildUpdateEntityScreen({required this.entity}); + + @override + _ChildUpdateEntityScreenState createState() => _ChildUpdateEntityScreenState(); +} + +class _ChildUpdateEntityScreenState extends State { + final _formKey = GlobalKey(); + +@override + Widget build(BuildContext context) { + return Consumer( + builder: (context, viewModel, child) { +// Start with all fields, then remove upload fields (generic filter by keys) + final Set hiddenKeys = { + + + }; + final fields = ChildFields.getFields(context) + .where((f) => !hiddenKeys.contains(f.fieldKey)) + .toList(); return EntityUpdateScreen( + fields: fields, + initialData: widget.entity, + onSubmit: (data) => _handleSubmit(data), + title: 'Child', + isLoading: viewModel.isLoading, + errorMessage: + viewModel.errorMessage.isNotEmpty ? viewModel.errorMessage : null, + ); + }, + ); + } + + Future _handleSubmit(Map formData) async { + final provider = + Provider.of(context, listen: false); + final success = await provider.updateEntity(widget.entity['id'], formData); + + if (success && mounted) { + Navigator.pop(context); + } + } +} diff --git a/testflutterbugdt-demot1-f/authsec_flutter_new/base_project/lib/Entity/basic1/Child/Child_Repo/Child_repo_screen.dart b/testflutterbugdt-demot1-f/authsec_flutter_new/base_project/lib/Entity/basic1/Child/Child_Repo/Child_repo_screen.dart new file mode 100644 index 0000000..970005b --- /dev/null +++ b/testflutterbugdt-demot1-f/authsec_flutter_new/base_project/lib/Entity/basic1/Child/Child_Repo/Child_repo_screen.dart @@ -0,0 +1,91 @@ +import 'package:dio/dio.dart'; +import '../../../../data/network/base_network_service.dart'; +import '../../../../data/network/network_api_service.dart'; +import '../../../../resources/api_constants.dart'; +import 'package:base_project/data/response/api_response.dart'; + +class ChildRepoScreen { + + final String baseUrl = ApiConstants.baseUrl; + final BaseNetworkService _helper = NetworkApiService(); + final String _endpointPath = '/Child/Child'; + + Future>>> getEntities() async { + try { + final response = + await _helper.getGetApiResponse('$baseUrl$_endpointPath'); + print('Response received: $response'); + List> entities = const []; + if (response is List) { + entities = response + .whereType() + .map((e) => Map.from(e as Map)) + .toList(); + } else if (response is Map) { + final dynamic content = response['content']; + if (content is List) { + entities = content + .whereType() + .map((e) => Map.from(e as Map)) + .toList(); + } + } + return ApiResponse.success(entities); + } catch (e) { + print(' error got $e'); + return ApiResponse.error('Failed to get all entities: $e'); + } + } + + Future>>> getAllWithPagination( + int page, int size) async { + try { + final response = await _helper.getGetApiResponse( + '$baseUrl$_endpointPath/getall/page?page=$page&size=$size'); + + if (response is Map && response['content'] is List) { + final List> entities = + (response['content'] as List).cast>().toList(); + return ApiResponse.success(entities); + } else { + return ApiResponse.error('Invalid response format'); + } + } catch (e) { + return ApiResponse.error('Failed to get all without pagination: $e'); + } + } + + Future>> createEntity( + Map entity) async { + try { + print("in post api$entity"); + final response = + await _helper.getPostApiResponse('$baseUrl$_endpointPath', entity); + return ApiResponse.success(response as Map); + } catch (e) { + return ApiResponse.error('Failed to create entity: $e'); + } + } + + Future>> updateEntity( + int entityId, Map entity) async { + try { + final response = await _helper.getPutApiResponse( + '$baseUrl$_endpointPath/$entityId', entity); + return ApiResponse.success(response as Map); + } catch (e) { + return ApiResponse.error('Failed to update entity: $e'); + } + } + + Future> deleteEntity(int entityId) async { + try { + await _helper.getDeleteApiResponse('$baseUrl$_endpointPath/$entityId'); + return ApiResponse.success(null); + } catch (e) { + return ApiResponse.error('Failed to delete entity: $e'); + } + } + + +} diff --git a/testflutterbugdt-demot1-f/authsec_flutter_new/base_project/lib/Entity/basic1/Child/Child_viewModel/Child_view_model_screen.dart b/testflutterbugdt-demot1-f/authsec_flutter_new/base_project/lib/Entity/basic1/Child/Child_viewModel/Child_view_model_screen.dart new file mode 100644 index 0000000..99bdd02 --- /dev/null +++ b/testflutterbugdt-demot1-f/authsec_flutter_new/base_project/lib/Entity/basic1/Child/Child_viewModel/Child_view_model_screen.dart @@ -0,0 +1,276 @@ +import 'package:base_project/data/response/status.dart'; +import 'dart:typed_data'; +import 'package:dio/dio.dart'; +import 'package:http_parser/http_parser.dart'; +import '../../../../utils/toast_messages/toast_message_util.dart'; +import '../../../../BuilderField/shared/utils/entity_field_store.dart'; +import 'package:flutter/material.dart'; +import '../Child_Repo/Child_repo_screen.dart'; + +class ChildViewModelScreen extends ChangeNotifier{ + final ChildRepoScreen repo = ChildRepoScreen(); + + + // State variables + List> _childList = []; + List> _filteredList = []; + bool _isLoading = false; + String _errorMessage = ''; + int _currentPage = 0; + int _pageSize = 10; + bool _hasMoreData = true; + String _searchQuery = ''; + + // Getters + List> get childList => _childList; + List> get filteredList => _filteredList; + bool get isLoading => _isLoading; + String get errorMessage => _errorMessage; + bool get hasMoreData => _hasMoreData; + String get searchQuery => _searchQuery; + + // Set loading state + void _setLoading(bool loading) { + _isLoading = loading; + notifyListeners(); + } + + // Set error message + void _setError(String error) { + _errorMessage = error; + notifyListeners(); + } + + // Clear error + void clearError() { + _errorMessage = ''; + notifyListeners(); + } + + // Get child list + Future getEntities() async { + _setLoading(true); + _setError(''); + + try { + final response = await repo.getEntities(); + + if (response.status == Status.SUCCESS) { + _childList = response.data ?? []; + _filteredList = List.from(_childList); + _currentPage = 0; + _hasMoreData = true; + } else { + _setError(response.message ?? 'Failed to fetch child list'); + } + } catch (e) { + _setError('Failed to fetch child list: $e'); + } finally { + _setLoading(false); + } + } + + // Get child list with pagination + Future getAllWithPagination({bool refresh = false}) async { + if (refresh) { + _currentPage = 0; + _childList.clear(); + _filteredList.clear(); + _hasMoreData = true; + } + + if (!_hasMoreData || _isLoading) return; + + _setLoading(true); + _setError(''); + + try { + final response = await repo.getAllWithPagination(_currentPage, _pageSize); + + if (response.status == Status.SUCCESS) { + final newItems = response.data ?? []; + + if (refresh) { + _childList = newItems; + } else { + _childList.addAll(newItems); + } + + _filteredList = List.from(_childList); + _currentPage++; + + // Check if we have more data + _hasMoreData = newItems.length == _pageSize; + } else { + _setError(response.message ?? 'Failed to fetch Child list'); + } + } catch (e) { + _setError('Failed to fetch child list: $e'); + } finally { + _setLoading(false); + } + } + + + + // Create Child + Future createEntity(Map entity) async { + _setLoading(true); + _setError(''); + + try { + + + final response = await repo.createEntity(entity); + + if (response.status == Status.SUCCESS) { +// Get the response ID for image upload + + final responseId = response.data!['id'].toString(); + + + ToastMessageUtil.showToast( + message: 'child created successfully', + toastType: ToastType.success, + ); + + // Refresh the list + await getEntities(); + + + return true; + } else { + _setError(response.message ?? 'Failed to create Child'); + ToastMessageUtil.showToast( + message: response.message ?? 'Failed to create Child', + toastType: ToastType.error, + ); + return false; + } + } catch (e) { + _setError('Failed to create child: $e'); + ToastMessageUtil.showToast( + message: 'Failed to create Child: $e', + toastType: ToastType.error, + ); + return false; + } finally { + _setLoading(false); + } + } + + // Update child + Future updateEntity(int id, Map entity) async { + _setLoading(true); + _setError(''); + + try { + final response = await repo.updateEntity(id, entity); + + if (response.status == Status.SUCCESS) { + ToastMessageUtil.showToast( + message: 'Child updated successfully', + toastType: ToastType.success, + ); + + // Update the item in the list + final index = _childList.indexWhere((item) => item['id'] == id); + if (index != -1) { + _childList[index] = response.data!; + _filteredList = List.from(_childList); + notifyListeners(); + } + return true; + } else { + _setError(response.message ?? 'Failed to update Child'); + ToastMessageUtil.showToast( + message: response.message ?? 'Failed to update Child', + toastType: ToastType.error, + ); + return false; + } + } catch (e) { + _setError('Failed to update child: $e'); + ToastMessageUtil.showToast( + message: 'Failed to update Child: $e', + toastType: ToastType.error, + ); + return false; + } finally { + _setLoading(false); + } + } + + // Delete child + Future deleteEntity(int id) async { + _setLoading(true); + _setError(''); + + try { + final response = await repo.deleteEntity(id); + + if (response.status == Status.SUCCESS) { + ToastMessageUtil.showToast( + message: 'Child deleted successfully', + toastType: ToastType.success, + ); + + // Remove the item from the list + _childList.removeWhere((item) => item['id'] == id); + _filteredList = List.from(_childList); + notifyListeners(); + return true; + } else { + _setError(response.message ?? 'Failed to delete Child'); + ToastMessageUtil.showToast( + message: response.message ?? 'Failed to delete Child', + toastType: ToastType.error, + ); + return false; + } + } catch (e) { + _setError('Failed to delete child: $e'); + ToastMessageUtil.showToast( + message: 'Failed to delete Child: $e', + toastType: ToastType.error, + ); + return false; + } finally { + _setLoading(false); + } + } + + // Search child + void searchchild(String query) { + _searchQuery = query; + + if (query.isEmpty) { + _filteredList = List.from(_childList); + } else { + _filteredList = _childList.where((item) { + return + + +(item['namek']?.toString().toLowerCase().contains(query.toLowerCase()) ??false) + + +; + }).toList(); + } + notifyListeners(); + } + + // Clear search + void clearSearch() { + _searchQuery = ''; + _filteredList = List.from(_childList); + notifyListeners(); + } + + // Refresh data + Future refreshData() async { + await getAllWithPagination(refresh: true); + } + + +} \ No newline at end of file diff --git a/testflutterbugdt-demot1-f/authsec_flutter_new/base_project/lib/Entity/basic1/Testbug/TestbugView/Testbug_api_service.dart b/testflutterbugdt-demot1-f/authsec_flutter_new/base_project/lib/Entity/basic1/Testbug/TestbugView/Testbug_api_service.dart new file mode 100644 index 0000000..de8b99d --- /dev/null +++ b/testflutterbugdt-demot1-f/authsec_flutter_new/base_project/lib/Entity/basic1/Testbug/TestbugView/Testbug_api_service.dart @@ -0,0 +1,112 @@ +import 'dart:typed_data'; +import 'package:dio/dio.dart'; +import 'package:http_parser/http_parser.dart'; +import '../../../../resources/api_constants.dart'; +import '../../../../data/network/base_network_service.dart'; +import '../../../../data/network/network_api_service.dart'; + +class TestbugApiService { + final String baseUrl = ApiConstants.baseUrl; + + final BaseNetworkService _helper = NetworkApiService(); + + + + Future>> getEntities() async { + + try { + final response = await _helper.getGetApiResponse('$baseUrl/Testbug/Testbug'); + final entities = (response as List).cast>(); + return entities; + } catch (e) { + throw Exception('Failed to get all entities: $e'); + } + } +Future>> getAllWithPagination( + int page, int size) async { + try { + final response = + await _helper.getGetApiResponse('$baseUrl/Testbug/Testbug/getall/page?page=$page&size=$size'); + final entities = + (response['content'] as List).cast>(); + return entities; + } catch (e) { + throw Exception('Failed to get all without pagination: $e'); + } + } + Future> createEntity( + Map entity) async { + try { + print("in post api$entity"); + final response = + await _helper.getPostApiResponse('$baseUrl/Testbug/Testbug', entity); + + print(entity); + + // Assuming the response is a Map + Map responseData = response; + + return responseData; + } catch (e) { + throw Exception('Failed to create entity: $e'); + } + } + + + + + + + + + + + + + + + + + + + + + + Future updateEntity( int entityId, Map entity) async { + try { + await _helper.getPutApiResponse('$baseUrl/Testbug/Testbug/$entityId', + entity); print(entity); + + } catch (e) { + throw Exception('Failed to update entity: $e'); + } + } + + Future deleteEntity( int entityId) async { + try { + await _helper.getDeleteApiResponse('$baseUrl/Testbug/Testbug/$entityId'); + } catch (e) { + throw Exception('Failed to delete entity: $e'); + } + } + + + + + + + + + + + + + + + + + + + + +} \ No newline at end of file diff --git a/testflutterbugdt-demot1-f/authsec_flutter_new/base_project/lib/Entity/basic1/Testbug/TestbugView/Testbug_create_entity_screen.dart b/testflutterbugdt-demot1-f/authsec_flutter_new/base_project/lib/Entity/basic1/Testbug/TestbugView/Testbug_create_entity_screen.dart new file mode 100644 index 0000000..bab3381 --- /dev/null +++ b/testflutterbugdt-demot1-f/authsec_flutter_new/base_project/lib/Entity/basic1/Testbug/TestbugView/Testbug_create_entity_screen.dart @@ -0,0 +1,96 @@ +// ignore_for_file: use_build_context_synchronously +import 'dart:convert'; +import 'package:flutter/material.dart'; +import 'package:file_picker/file_picker.dart'; +import 'package:image_picker/image_picker.dart'; +import 'package:provider/provider.dart'; +import '../Testbug_viewModel/Testbug_view_model_screen.dart'; +import 'Testbug_fields.dart';import 'package:base_project/BuilderField/shared/ui/entity_screens.dart'; +import '../../../../utils/image_constant.dart'; +import '../../../../utils/size_utils.dart'; +import '../../../../theme/app_style.dart'; +import '../../../../widgets/app_bar/appbar_image.dart'; +import '../../../../widgets/app_bar/appbar_title.dart'; +import '../../../../widgets/app_bar/custom_app_bar.dart'; +import '../../../../widgets/custom_button.dart'; +import '../../../../widgets/custom_text_form_field.dart'; +import '../../../../widgets/custom_dropdown_field.dart'; +import 'dart:math'; +import 'package:qr_flutter/qr_flutter.dart'; +import 'package:barcode_widget/barcode_widget.dart'; +import 'package:intl/intl.dart'; + +import 'package:autocomplete_textfield/autocomplete_textfield.dart'; +import 'package:http/http.dart' as http; +import 'package:flutter/services.dart'; +import 'package:image_picker/image_picker.dart'; +import 'package:fluttertoast/fluttertoast.dart'; +import '../../../../Reuseable/reusable_date_picker_field.dart'; +import '../../../../Reuseable/reusable_date_time_picker_field.dart' +;import 'package:multi_select_flutter/multi_select_flutter.dart'; +import 'package:just_audio/just_audio.dart'; +import 'package:video_player/video_player.dart'; +import 'package:google_fonts/google_fonts.dart'; +import 'package:lottie/lottie.dart'; +import '../../../../utils/toast_messages/toast_message_util.dart'; +import 'dart:io'; +import '../../../../Reuseable/reusable_text_field.dart'; +import '../../../../Reuseable/reusable_dropdown_field.dart'; + + + + + + + + + + + + + + + + + + + + +class TestbugCreateEntityScreen extends StatefulWidget { + const TestbugCreateEntityScreen({super.key}); + + @override + _TestbugCreateEntityScreenState createState() => _TestbugCreateEntityScreenState(); +} + +class _TestbugCreateEntityScreenState extends State { + +final Map formData = {}; + final _formKey = GlobalKey(); + + @override + Widget build(BuildContext context) { + return Consumer( + builder: (context, viewModel, child) { + return EntityCreateScreen( + fields: TestbugFields.getFields(context), + onSubmit: (data) => _handleSubmit(data), + title: 'Testbug', + isLoading: viewModel.isLoading, + errorMessage: + viewModel.errorMessage.isNotEmpty ? viewModel.errorMessage : null, + ); + }, + ); + } + + Future _handleSubmit(Map formData) async { + final provider = + Provider.of(context, listen: false); + final success = await provider.createEntity(formData); + + if (success && mounted) { + Navigator.pop(context); + } + } +} \ No newline at end of file diff --git a/testflutterbugdt-demot1-f/authsec_flutter_new/base_project/lib/Entity/basic1/Testbug/TestbugView/Testbug_details_screen.dart b/testflutterbugdt-demot1-f/authsec_flutter_new/base_project/lib/Entity/basic1/Testbug/TestbugView/Testbug_details_screen.dart new file mode 100644 index 0000000..8873273 --- /dev/null +++ b/testflutterbugdt-demot1-f/authsec_flutter_new/base_project/lib/Entity/basic1/Testbug/TestbugView/Testbug_details_screen.dart @@ -0,0 +1,104 @@ +// ignore_for_file: use_build_context_synchronously +import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; +import '../../../../BuilderField/shared/ui/entity_details.dart'; +import '../Testbug_viewModel/Testbug_view_model_screen.dart'; +import 'Testbug_update_entity_screen.dart'; + +class TestbugDetailsScreen extends StatefulWidget { + final Map entity; + + const TestbugDetailsScreen({ + super.key, + required this.entity, + }); + + @override + State createState() => _TestbugDetailsScreenState(); +} + +class _TestbugDetailsScreenState extends State { + void _navigateToUpdateScreen(Map entity) { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => ChangeNotifierProvider( + create: (context) => TestbugViewModelScreen(), + child: TestbugUpdateEntityScreen(entity: entity), + ), + ), + ).then((_) { + // Refresh the details screen with updated data + setState(() {}); + }); + } + + void _showDeleteDialog(Map entity) { + showDialog( + context: context, + builder: (BuildContext context) { + return AlertDialog( + title: const Text('Confirm Deletion'), + content: const Text('Are you sure you want to delete this Testbug?'), + actions: [ + TextButton( + child: const Text('Cancel'), + onPressed: () { + Navigator.of(context).pop(); + }, + ), + TextButton( + child: const Text('Delete'), + onPressed: () async { + Navigator.of(context).pop(); + final vm = + Provider.of(context, listen: false); + final success = await vm.deleteEntity(entity['id']); + if (success && mounted) { + Navigator.pop(context); // Go back to list + } + }, + ), + ], + ); + }, + ); + } + + @override + Widget build(BuildContext context) { + return Consumer( + builder: (context, viewModel, child) { + return EntityDetails( + entity: widget.entity, + onEdit: (entity) => _navigateToUpdateScreen(entity), + onDelete: (entity) => _showDeleteDialog(entity), + title: 'Testbug', + displayFields: [ + {'key': 'name', 'label': 'Name', 'type': 'text'}, + + + + {'key': 'field_groupnn', 'label': 'Field Groupnn', 'type': 'field_group'}, + + + + {'key': 'value_list_fieldcc', 'label': 'Value List Fieldcc', 'type': 'value_list'}, + + + + {'key': 'select_dyanamic', 'label': 'select dyanamic', 'type': 'select'}, + + {'key': 'select_dynamic_mul', 'label': 'select dynamic mul', 'type': 'select'}, + + {'key': 'select_autocompidentifier', 'label': 'select autocompidentifier', 'type': 'select'}, + + {'key': 'select_autcomp_mul', 'label': 'select autcomp mul', 'type': 'select'}, + + ], + isLoading: viewModel.isLoading, + ); + }, + ); + } +} diff --git a/testflutterbugdt-demot1-f/authsec_flutter_new/base_project/lib/Entity/basic1/Testbug/TestbugView/Testbug_entity_list_screen.dart b/testflutterbugdt-demot1-f/authsec_flutter_new/base_project/lib/Entity/basic1/Testbug/TestbugView/Testbug_entity_list_screen.dart new file mode 100644 index 0000000..e09554a --- /dev/null +++ b/testflutterbugdt-demot1-f/authsec_flutter_new/base_project/lib/Entity/basic1/Testbug/TestbugView/Testbug_entity_list_screen.dart @@ -0,0 +1,164 @@ +// ignore_for_file: use_build_context_synchronously +import 'package:flutter/material.dart'; +import 'package:intl/intl.dart'; +import 'package:base_project/BuilderField/shared/ui/entity_list.dart'; +import 'Testbug_create_entity_screen.dart'; +import 'Testbug_update_entity_screen.dart'; +import '../Testbug_viewModel/Testbug_view_model_screen.dart'; +import 'Testbug_details_screen.dart';import 'package:flutter/services.dart'; +import 'package:speech_to_text/speech_to_text.dart' as stt; +import '../../../../theme/app_style.dart'; +import '../../../../utils/size_utils.dart'; +import '../../../../widgets/custom_icon_button.dart'; +import '../../../../utils/image_constant.dart'; +import '../../../../widgets/app_bar/appbar_image.dart'; +import '../../../../widgets/app_bar/appbar_title.dart'; +import '../../../../widgets/app_bar/custom_app_bar.dart'; +import '../../../../theme/app_decoration.dart'; +import 'package:multi_select_flutter/multi_select_flutter.dart'; +import '../../../../Reuseable/reusable_text_field.dart'; +import 'package:provider/provider.dart'; +import '../../../../utils/toast_messages/toast_message_util.dart'; +import 'package:fluttertoast/fluttertoast.dart'; + +class Testbug_entity_list_screen extends StatefulWidget { + static const String routeName = '/entity-list'; + + @override + _Testbug_entity_list_screenState createState() => _Testbug_entity_list_screenState(); +} + +class _Testbug_entity_list_screenState extends State { + @override + void initState() { + super.initState(); + _loadData(); + } + + void _loadData() { + WidgetsBinding.instance.addPostFrameCallback((_) { + if (mounted) { + final vm = Provider.of(context, listen: false); + vm.getAllWithPagination(refresh: true); + } + }); + } + + void _navigateToCreateScreen() { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => ChangeNotifierProvider( + create: (context) => TestbugViewModelScreen(), + child: const TestbugCreateEntityScreen(), + ), + ), + ).then((_) { + final vm = Provider.of(context, listen: false); + vm.refreshData(); + }); + } + + void _navigateToUpdateScreen(Map entity) { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => ChangeNotifierProvider( + create: (context) => TestbugViewModelScreen(), + child: TestbugUpdateEntityScreen(entity: entity), + ), + ), + ).then((_) { + final vm = Provider.of(context, listen: false); + vm.refreshData(); + }); + } + + void _navigateToDetailsScreen(Map entity) { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => ChangeNotifierProvider( + create: (context) => TestbugViewModelScreen(), + child: TestbugDetailsScreen(entity: entity), + ), + ), + ); + } + + void _showDeleteDialog(Map entity) { + final parentContext = context; + showDialog( + context: context, + builder: (BuildContext context) { + return AlertDialog( + title: const Text('Confirm Deletion'), + content: const Text('Are you sure you want to delete this Testbug?'), + actions: [ + TextButton( + child: const Text('Cancel'), + onPressed: () { + Navigator.of(context).pop(); + }, + ), + TextButton( + child: const Text('Delete'), + onPressed: () async { + Navigator.of(context).pop(); + final vm = + Provider.of(parentContext, listen: false); + await vm.deleteEntity(entity['id']); + }, + ), + ], + ); + }, + ); + } + + @override + Widget build(BuildContext context) { + return Consumer( + builder: (context, viewModel, child) { + return EntityList( + entities: viewModel.filteredList, + isLoading: viewModel.isLoading, + errorMessage: + viewModel.errorMessage.isNotEmpty ? viewModel.errorMessage : null, + hasMoreData: viewModel.hasMoreData, + searchQuery: viewModel.searchQuery, + onSearchChanged: (query) => viewModel.searchtestbug(query), + onEdit: (entity) => _navigateToUpdateScreen(entity), + onDelete: (entity) => _showDeleteDialog(entity), + onTap: (entity) => _navigateToDetailsScreen(entity), + onRefresh: () => viewModel.refreshData(), + onLoadMore: () => viewModel.getAllWithPagination(), + title: 'Testbug', + onAddNew: _navigateToCreateScreen, + displayFields: [ + {'key': 'name', 'label': 'Name', 'type': 'text'}, + + + + {'key': 'field_groupnn', 'label': 'Field Groupnn', 'type': 'field_group'}, + + + + {'key': 'value_list_fieldcc', 'label': 'Value List Fieldcc', 'type': 'value_list'}, + + + + {'key': 'select_dyanamic', 'label': 'select dyanamic', 'type': 'select'}, + + {'key': 'select_dynamic_mul', 'label': 'select dynamic mul', 'type': 'select'}, + + {'key': 'select_autocompidentifier', 'label': 'select autocompidentifier', 'type': 'select'}, + + {'key': 'select_autcomp_mul', 'label': 'select autcomp mul', 'type': 'select'}, + + ], + ); + }, + ); + } +} diff --git a/testflutterbugdt-demot1-f/authsec_flutter_new/base_project/lib/Entity/basic1/Testbug/TestbugView/Testbug_fields.dart b/testflutterbugdt-demot1-f/authsec_flutter_new/base_project/lib/Entity/basic1/Testbug/TestbugView/Testbug_fields.dart new file mode 100644 index 0000000..da01afb --- /dev/null +++ b/testflutterbugdt-demot1-f/authsec_flutter_new/base_project/lib/Entity/basic1/Testbug/TestbugView/Testbug_fields.dart @@ -0,0 +1,210 @@ +import 'package:base_project/BuilderField/shared/fields/number_field.dart'; +import 'package:base_project/BuilderField/shared/fields/password_field.dart'; +import 'package:base_project/BuilderField/shared/fields/phone_field.dart'; +import 'package:base_project/BuilderField/shared/fields/custom_text_field.dart'; + +import '../../../../BuilderField/shared/fields/base_field.dart'; + +import '../../../../BuilderField/shared/fields/date_field.dart'; +import '../../../../BuilderField/shared/fields/datetime_field.dart'; +import '../../../../BuilderField/shared/fields/email_field.dart'; +import 'package:base_project/BuilderField/shared/fields/url_field.dart'; +import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; + +import '../../../../BuilderField/shared/fields/custom_text_field.dart' as shared_text; +import '../../../../BuilderField/shared/fields/one_to_one_relation_field.dart'; +import '../../../../BuilderField/shared/fields/calculated_field.dart'; +import '../../../../BuilderField/shared/fields/one_to_many_field.dart'; +import '../../../../BuilderField/shared/fields/value_list_picker_field.dart'; +import '../../../../BuilderField/shared/fields/captcha_field.dart'; +import '../../../../BuilderField/shared/fields/switch_field.dart'; +import '../../../../BuilderField/shared/fields/url_field.dart'; + +import '../../../../BuilderField/shared/fields/audio_upload_field.dart'; +import '../../../../BuilderField/shared/fields/checkbox_field.dart'; +import '../../../../BuilderField/shared/fields/file_upload_field.dart'; +import '../../../../BuilderField/shared/fields/image_upload_field.dart'; +import '../../../../BuilderField/shared/fields/radio_field.dart'; +import '../../../../BuilderField/shared/fields/video_upload_field.dart'; + +import '../../../../BuilderField/shared/fields/autocomplete_dropdown_field.dart'; +import '../../../../BuilderField/shared/fields/autocomplete_multiselect_field.dart'; +import '../../../../BuilderField/shared/fields/one_to_one_relation_field.dart'; +import '../../../../BuilderField/shared/fields/data_grid_field.dart'; +import '../../../../BuilderField/shared/fields/dropdown_field.dart'; +import '../../../../BuilderField/shared/fields/dynamic_dropdown_field.dart'; +import '../../../../BuilderField/shared/fields/dynamic_multiselect_dropdown_field.dart'; +import '../../../../BuilderField/shared/fields/static_multiselect_field.dart'; +import '../../../../BuilderField/shared/fields/currency_field.dart'; +import '../../../../BuilderField/shared/fields/field_group_field.dart'; +import '../../../../BuilderField/shared/fields/qr_code_field.dart'; +import '../../../../BuilderField/shared/fields/barcode_field.dart'; +import '../../../../BuilderField/shared/fields/dependent_dropdown_field.dart'; + import '../Testbug_viewModel/Testbug_view_model_screen.dart';/// Field definitions for Testbug entity +/// This defines the structure and validation for Testbug forms +class TestbugFields { + /// Get field definitions for Testbug entity + static List getFields(BuildContext context) { + final viewModel = + Provider.of(context, listen: false); + return [ + // Basic Information + CustomTextField( + fieldKey: 'name', + label: 'Name', + hint: 'Enter Name', + isRequired: true, + maxLength: 50, + ), + +FileUploadField( + fieldKey: 'fileupload_fields', + label: 'Fileupload Fields', + isRequired: false, + ), + + FieldGroupField( + fieldKey: 'field_groupnn', + label: 'Field Groupnn', + hint: 'Enter Field Groupnn', + subFields: [ + + + GroupSubField(path: 'bar_code', label: 'bar_code', isRequired: true), + + + + GroupSubField(path: 'qr_code', label: 'qr_code', isRequired: true), + + + + ], + ), + +OneToOneRelationField( + fieldKey: 'child', + label: 'child', + hint: 'child details', + relationSchema: { + 'title': 'child', + 'box': true, + 'fields': [ + + + { + 'type': 'text', + 'label': 'Namek', + 'hint': 'Enter Namek', + 'path': 'support.namek', + }, + + + + ], + }, + ), + + +// 3) Value list picker – fill fields from selection (provide your loader) + ValueListPickerField( + fieldKey: 'value_list_fieldcc', + label: 'Value List Fieldcc', + optionsLoader: () async { + try { + await viewModel.getEntities(); + final response = viewModel.testbugList; + return response; + } catch (e) { + // Return empty list if API fails + return >[]; + } + }, + fillMappings: const { + + + 'name': 'name', + + + + }, + ), + + DataGridField( + fieldKey: 'datagrid_fieldv', + label: 'datagrid Fieldv', + dataLoader: () => viewModel.getdatagrid_fieldvGrid(), + ), + + DynamicDropdownField( + fieldKey: 'select_dyanamic', + label: 'Select select dyanamic', + hint: 'Search and select', + optionsLoader: () => viewModel.getselect_dyanamic(), + + + valueKey: 'id', + displayKey: 'name', + + + ), + + + DynamicMultiSelectDropdownField( + fieldKey: 'select_dynamic_mul', + label: 'select dynamic mul', + hint: 'Type to search and press enter', + optionsLoader: () async { + final list = await viewModel.getselect_dynamic_mul(); + return list + + + .map((e) => e['name']?.toString() ?? '') + .where((e) => e.isNotEmpty) + .toList(); + + + }, + ), + + + + + AutocompleteDropdownField( + fieldKey: 'select_autocomp', + label: 'select autocomp', + hint: 'Select select autocomp', + optionsLoader: () async => await viewModel.getselect_autocomp(), + + + valueKey: 'id', + displayKey: 'name', + + + isRequired: false, + ), + + + + AutocompleteMultiSelectField( + fieldKey: 'select_autcomp_mul', + label: 'select autcomp mul', + hint: 'Select select autcomp mul', + isRequired: false, + optionsLoader: () async { + final data = await viewModel.getselect_autcomp_mul(); + + + return data + .map((e) => e['id']) + .where((e) => e != null) + .map((e) => e.toString()) + .toList(); + + + }, + ), + + ]; + } +} diff --git a/testflutterbugdt-demot1-f/authsec_flutter_new/base_project/lib/Entity/basic1/Testbug/TestbugView/Testbug_update_entity_screen.dart b/testflutterbugdt-demot1-f/authsec_flutter_new/base_project/lib/Entity/basic1/Testbug/TestbugView/Testbug_update_entity_screen.dart new file mode 100644 index 0000000..50dc478 --- /dev/null +++ b/testflutterbugdt-demot1-f/authsec_flutter_new/base_project/lib/Entity/basic1/Testbug/TestbugView/Testbug_update_entity_screen.dart @@ -0,0 +1,91 @@ +// ignore_for_file: use_build_context_synchronously +import 'dart:convert'; +import 'package:provider/provider.dart'; +import '../Testbug_viewModel/Testbug_view_model_screen.dart'; +import 'package:base_project/BuilderField/shared/ui/entity_screens.dart'; +import 'Testbug_fields.dart';import '../../../../utils/image_constant.dart'; +import '../../../../utils/size_utils.dart'; +import '../../../../theme/app_style.dart'; +import '../../../../widgets/app_bar/appbar_image.dart'; +import '../../../../widgets/app_bar/appbar_title.dart'; +import '../../../../widgets/app_bar/custom_app_bar.dart'; +import 'package:barcode_widget/barcode_widget.dart'; +import 'package:fluttertoast/fluttertoast.dart'; +import '../../../../widgets/custom_button.dart'; +import '../../../../widgets/custom_text_form_field.dart'; +import 'package:flutter/material.dart'; +import 'package:autocomplete_textfield/autocomplete_textfield.dart'; +import 'package:qr_flutter/qr_flutter.dart'; +import 'package:intl/intl.dart'; + +import 'dart:math'; +import '../../../../Reuseable/reusable_text_field.dart'; +import '../../../../Reuseable/reusable_date_picker_field.dart'; +import '../../../../Reuseable/reusable_date_time_picker_field.dart'; +import '../../../../Reuseable/reusable_dropdown_field.dart'; +import 'package:flutter/services.dart'; +class TestbugUpdateEntityScreen extends StatefulWidget { + final Map entity; + + + TestbugUpdateEntityScreen({required this.entity}); + + @override + _TestbugUpdateEntityScreenState createState() => _TestbugUpdateEntityScreenState(); +} + +class _TestbugUpdateEntityScreenState extends State { + final _formKey = GlobalKey(); + +@override + Widget build(BuildContext context) { + return Consumer( + builder: (context, viewModel, child) { +// Start with all fields, then remove upload fields (generic filter by keys) + final Set hiddenKeys = { + + +'fileupload_fields', + + + + + + + + + + + + + + + + + + }; + final fields = TestbugFields.getFields(context) + .where((f) => !hiddenKeys.contains(f.fieldKey)) + .toList(); return EntityUpdateScreen( + fields: fields, + initialData: widget.entity, + onSubmit: (data) => _handleSubmit(data), + title: 'Testbug', + isLoading: viewModel.isLoading, + errorMessage: + viewModel.errorMessage.isNotEmpty ? viewModel.errorMessage : null, + ); + }, + ); + } + + Future _handleSubmit(Map formData) async { + final provider = + Provider.of(context, listen: false); + final success = await provider.updateEntity(widget.entity['id'], formData); + + if (success && mounted) { + Navigator.pop(context); + } + } +} diff --git a/testflutterbugdt-demot1-f/authsec_flutter_new/base_project/lib/Entity/basic1/Testbug/Testbug_Repo/Testbug_repo_screen.dart b/testflutterbugdt-demot1-f/authsec_flutter_new/base_project/lib/Entity/basic1/Testbug/Testbug_Repo/Testbug_repo_screen.dart new file mode 100644 index 0000000..f651bf7 --- /dev/null +++ b/testflutterbugdt-demot1-f/authsec_flutter_new/base_project/lib/Entity/basic1/Testbug/Testbug_Repo/Testbug_repo_screen.dart @@ -0,0 +1,158 @@ +import 'package:dio/dio.dart'; +import '../../../../data/network/base_network_service.dart'; +import '../../../../data/network/network_api_service.dart'; +import '../../../../resources/api_constants.dart'; +import 'package:base_project/data/response/api_response.dart'; + +class TestbugRepoScreen { + + final String baseUrl = ApiConstants.baseUrl; + final BaseNetworkService _helper = NetworkApiService(); + final String _endpointPath = '/Testbug/Testbug'; + + Future>>> getEntities() async { + try { + final response = + await _helper.getGetApiResponse('$baseUrl$_endpointPath'); + print('Response received: $response'); + List> entities = const []; + if (response is List) { + entities = response + .whereType() + .map((e) => Map.from(e as Map)) + .toList(); + } else if (response is Map) { + final dynamic content = response['content']; + if (content is List) { + entities = content + .whereType() + .map((e) => Map.from(e as Map)) + .toList(); + } + } + return ApiResponse.success(entities); + } catch (e) { + print(' error got $e'); + return ApiResponse.error('Failed to get all entities: $e'); + } + } + + Future>>> getAllWithPagination( + int page, int size) async { + try { + final response = await _helper.getGetApiResponse( + '$baseUrl$_endpointPath/getall/page?page=$page&size=$size'); + + if (response is Map && response['content'] is List) { + final List> entities = + (response['content'] as List).cast>().toList(); + return ApiResponse.success(entities); + } else { + return ApiResponse.error('Invalid response format'); + } + } catch (e) { + return ApiResponse.error('Failed to get all without pagination: $e'); + } + } + + Future>> createEntity( + Map entity) async { + try { + print("in post api$entity"); + final response = + await _helper.getPostApiResponse('$baseUrl$_endpointPath', entity); + return ApiResponse.success(response as Map); + } catch (e) { + return ApiResponse.error('Failed to create entity: $e'); + } + } + + Future>> updateEntity( + int entityId, Map entity) async { + try { + final response = await _helper.getPutApiResponse( + '$baseUrl$_endpointPath/$entityId', entity); + return ApiResponse.success(response as Map); + } catch (e) { + return ApiResponse.error('Failed to update entity: $e'); + } + } + + Future> deleteEntity(int entityId) async { + try { + await _helper.getDeleteApiResponse('$baseUrl$_endpointPath/$entityId'); + return ApiResponse.success(null); + } catch (e) { + return ApiResponse.error('Failed to delete entity: $e'); + } + } + + + Future fileupload_fieldsUpload( + String ref, String refTableNmae, FormData entity) async { + try { + String apiUrl = "$baseUrl/FileUpload/Uploadeddocs/$ref/$refTableNmae"; + final response = await _helper.getPostApiResponse(apiUrl, entity); + return response; + } catch (e) { + throw Exception('Failed to Upload File: $e'); + } + } + + + + + + + + Future getdatagrid_fieldvGrid() async { + try { + String apiUrl = "$baseUrl/Testlist_ListFilter1/Testlist_ListFilter1"; + final response = await _helper.getGetApiResponse(apiUrl); + return response; + } catch (e) { + throw Exception('Failed to Upload datagrid Fieldv: $e'); + } + } + + Future getselect_dyanamic() async { + try { + String apiUrl = "$baseUrl/Testlist_ListFilter1/Testlist_ListFilter1"; + final response = await _helper.getGetApiResponse(apiUrl); + return response; + } catch (e) { + throw Exception('Failed to Get: $e'); + } + } + + Future getselect_dynamic_mul() async { + try { + String apiUrl = "$baseUrl/Testlist_ListFilter1/Testlist_ListFilter1"; + final response = await _helper.getGetApiResponse(apiUrl); + return response; + } catch (e) { + throw Exception('Failed to Get: $e'); + } + } + + Future getselect_autocomp() async { + try { + String apiUrl = "$baseUrl/Testlist_ListFilter1/Testlist_ListFilter1"; + final response = await _helper.getGetApiResponse(apiUrl); + return response; + } catch (e) { + throw Exception('Failed to Get: $e'); + } + } + + Future getselect_autcomp_mul() async { + try { + String apiUrl = "$baseUrl/Testlist_ListFilter1/Testlist_ListFilter1"; + final response = await _helper.getGetApiResponse(apiUrl); + return response; + } catch (e) { + throw Exception('Failed to Get: $e'); + } + } + +} diff --git a/testflutterbugdt-demot1-f/authsec_flutter_new/base_project/lib/Entity/basic1/Testbug/Testbug_viewModel/Testbug_view_model_screen.dart b/testflutterbugdt-demot1-f/authsec_flutter_new/base_project/lib/Entity/basic1/Testbug/Testbug_viewModel/Testbug_view_model_screen.dart new file mode 100644 index 0000000..435f3bd --- /dev/null +++ b/testflutterbugdt-demot1-f/authsec_flutter_new/base_project/lib/Entity/basic1/Testbug/Testbug_viewModel/Testbug_view_model_screen.dart @@ -0,0 +1,590 @@ +import 'package:base_project/data/response/status.dart'; +import 'dart:typed_data'; +import 'package:dio/dio.dart'; +import 'package:http_parser/http_parser.dart'; +import '../../../../utils/toast_messages/toast_message_util.dart'; +import '../../../../BuilderField/shared/utils/entity_field_store.dart'; +import 'package:flutter/material.dart'; +import '../Testbug_Repo/Testbug_repo_screen.dart'; + +class TestbugViewModelScreen extends ChangeNotifier{ + final TestbugRepoScreen repo = TestbugRepoScreen(); + + + // State variables + List> _testbugList = []; + List> _filteredList = []; + bool _isLoading = false; + String _errorMessage = ''; + int _currentPage = 0; + int _pageSize = 10; + bool _hasMoreData = true; + String _searchQuery = ''; + + // Getters + List> get testbugList => _testbugList; + List> get filteredList => _filteredList; + bool get isLoading => _isLoading; + String get errorMessage => _errorMessage; + bool get hasMoreData => _hasMoreData; + String get searchQuery => _searchQuery; + + // Set loading state + void _setLoading(bool loading) { + _isLoading = loading; + notifyListeners(); + } + + // Set error message + void _setError(String error) { + _errorMessage = error; + notifyListeners(); + } + + // Clear error + void clearError() { + _errorMessage = ''; + notifyListeners(); + } + + // Get testbug list + Future getEntities() async { + _setLoading(true); + _setError(''); + + try { + final response = await repo.getEntities(); + + if (response.status == Status.SUCCESS) { + _testbugList = response.data ?? []; + _filteredList = List.from(_testbugList); + _currentPage = 0; + _hasMoreData = true; + } else { + _setError(response.message ?? 'Failed to fetch testbug list'); + } + } catch (e) { + _setError('Failed to fetch testbug list: $e'); + } finally { + _setLoading(false); + } + } + + // Get testbug list with pagination + Future getAllWithPagination({bool refresh = false}) async { + if (refresh) { + _currentPage = 0; + _testbugList.clear(); + _filteredList.clear(); + _hasMoreData = true; + } + + if (!_hasMoreData || _isLoading) return; + + _setLoading(true); + _setError(''); + + try { + final response = await repo.getAllWithPagination(_currentPage, _pageSize); + + if (response.status == Status.SUCCESS) { + final newItems = response.data ?? []; + + if (refresh) { + _testbugList = newItems; + } else { + _testbugList.addAll(newItems); + } + + _filteredList = List.from(_testbugList); + _currentPage++; + + // Check if we have more data + _hasMoreData = newItems.length == _pageSize; + } else { + _setError(response.message ?? 'Failed to fetch Testbug list'); + } + } catch (e) { + _setError('Failed to fetch testbug list: $e'); + } finally { + _setLoading(false); + } + } + + + +// Variable to store image files + List> _fileupload_fieldsFiles = []; + + + + + + + + + + + + + + + + + + // Create Testbug + Future createEntity(Map entity) async { + _setLoading(true); + _setError(''); + + try { + + + // Always source image selections from EntityFieldStore for simplicity + final List storefilefileupload_fields = EntityFieldStore.instance + .get>('fileupload_fields') ?? + []; + + _fileupload_fieldsFiles = storefilefileupload_fields + .map((u) => {'path': u.fileName, 'bytes': u.bytes}) + .toList(); + + + entity.remove('fileupload_fields'); + + + + + + + + + + + + + + + + + + + final response = await repo.createEntity(entity); + + if (response.status == Status.SUCCESS) { +// Get the response ID for image upload + + final responseId = response.data!['id'].toString(); + + +// Upload File if available + if (_fileupload_fieldsFiles.isNotEmpty) { + await _uploadfileupload_fields(responseId, _fileupload_fieldsFiles); + _fileupload_fieldsFiles.clear(); // Clear after upload + } + + + + + + + + + + + + + + + + + + ToastMessageUtil.showToast( + message: 'testbug created successfully', + toastType: ToastType.success, + ); + + // Refresh the list + await getEntities(); + + + EntityFieldStore.instance.remove('fileupload_fields'); + + + + + + + + + + + + + + + + + + + return true; + } else { + _setError(response.message ?? 'Failed to create Testbug'); + ToastMessageUtil.showToast( + message: response.message ?? 'Failed to create Testbug', + toastType: ToastType.error, + ); + return false; + } + } catch (e) { + _setError('Failed to create testbug: $e'); + ToastMessageUtil.showToast( + message: 'Failed to create Testbug: $e', + toastType: ToastType.error, + ); + return false; + } finally { + _setLoading(false); + } + } + + // Update testbug + Future updateEntity(int id, Map entity) async { + _setLoading(true); + _setError(''); + + try { + final response = await repo.updateEntity(id, entity); + + if (response.status == Status.SUCCESS) { + ToastMessageUtil.showToast( + message: 'Testbug updated successfully', + toastType: ToastType.success, + ); + + // Update the item in the list + final index = _testbugList.indexWhere((item) => item['id'] == id); + if (index != -1) { + _testbugList[index] = response.data!; + _filteredList = List.from(_testbugList); + notifyListeners(); + } + return true; + } else { + _setError(response.message ?? 'Failed to update Testbug'); + ToastMessageUtil.showToast( + message: response.message ?? 'Failed to update Testbug', + toastType: ToastType.error, + ); + return false; + } + } catch (e) { + _setError('Failed to update testbug: $e'); + ToastMessageUtil.showToast( + message: 'Failed to update Testbug: $e', + toastType: ToastType.error, + ); + return false; + } finally { + _setLoading(false); + } + } + + // Delete testbug + Future deleteEntity(int id) async { + _setLoading(true); + _setError(''); + + try { + final response = await repo.deleteEntity(id); + + if (response.status == Status.SUCCESS) { + ToastMessageUtil.showToast( + message: 'Testbug deleted successfully', + toastType: ToastType.success, + ); + + // Remove the item from the list + _testbugList.removeWhere((item) => item['id'] == id); + _filteredList = List.from(_testbugList); + notifyListeners(); + return true; + } else { + _setError(response.message ?? 'Failed to delete Testbug'); + ToastMessageUtil.showToast( + message: response.message ?? 'Failed to delete Testbug', + toastType: ToastType.error, + ); + return false; + } + } catch (e) { + _setError('Failed to delete testbug: $e'); + ToastMessageUtil.showToast( + message: 'Failed to delete Testbug: $e', + toastType: ToastType.error, + ); + return false; + } finally { + _setLoading(false); + } + } + + // Search testbug + void searchtestbug(String query) { + _searchQuery = query; + + if (query.isEmpty) { + _filteredList = List.from(_testbugList); + } else { + _filteredList = _testbugList.where((item) { + return + + +(item['name']?.toString().toLowerCase().contains(query.toLowerCase()) ??false) || + + + + + + + + + +(item['field_groupnn']?.toString().toLowerCase().contains(query.toLowerCase()) ??false) || + + + + + + + +(item['field_groupnn']?.toString().toLowerCase().contains(query.toLowerCase()) ??false) || + + + + + + + +(item['child']?.toString().toLowerCase().contains(query.toLowerCase()) ??false) || + + + + + + + +(item['datagrid_fieldv']?.toString().toLowerCase().contains(query.toLowerCase()) ??false) || + + + + + +(item['select_dyanamic']?.toString().toLowerCase().contains(query.toLowerCase()) ??false) || + + + + + +(item['select_dynamic_mul']?.toString().toLowerCase().contains(query.toLowerCase()) ??false) || + + + + + +(item['select_autocompidentifier']?.toString().toLowerCase().contains(query.toLowerCase()) ??false) || + + + + + + +(item['select_autcomp_mul']?.toString().toLowerCase().contains(query.toLowerCase()) ??false) + + +; + }).toList(); + } + notifyListeners(); + } + + // Clear search + void clearSearch() { + _searchQuery = ''; + _filteredList = List.from(_testbugList); + notifyListeners(); + } + + // Refresh data + Future refreshData() async { + await getAllWithPagination(refresh: true); + } + + + + + + + + // Helper method to upload multiple image files + Future _uploadfileupload_fields( + String responseId, List Files) async { + try { + for (var File in Files) { + if (File is Map && + File.containsKey('path')) { + String filePath = File['path']; + Uint8List fileBytes = File['bytes']; + + // Upload each image file + await uploadfileupload_fields( + responseId, 'Testbug', filePath, fileBytes); + } + } + } catch (error) { + print('Error uploading files: $error'); + ToastMessageUtil.showToast( + message: "Failed to upload images", toastType: ToastType.error); + } + } + +// Modify the uploadfileupload_fieldsimage function + Future uploadfileupload_fields(String ref, String refTableNmae, + String selectedFilePath, Uint8List imageTimageBytes) async { + try { + + final Uint8List fileBytes = imageTimageBytes!; + final mimeType = fileupload_fieldslookupMimeType(selectedFilePath); + + FormData formData = FormData.fromMap({ + 'file': MultipartFile.fromBytes( + fileBytes, + filename: selectedFilePath + .split('/') + .last, // Get the file name from the path + contentType: MediaType.parse(mimeType!), + ), + }); + + + await repo.fileupload_fieldsUpload(ref, refTableNmae, formData).then((value) { + ToastMessageUtil.showToast( + message: "File uploaded successfully", + toastType: ToastType.success); + }).onError( + (error, stackTrace) { + print("error--$error"); + ToastMessageUtil.showToast( + message: "Failed to upload file", toastType: ToastType.error); + }, + ); + } catch (error) { + print('Error occurred during form submission: $error'); + } + } + +// Modify the lookupMimeType function if needed + String fileupload_fieldslookupMimeType(String filePath) { + final ext = filePath.split('.').last; + switch (ext) { + case 'jpg': + case 'jpeg': + return 'image/jpeg'; + case 'png': + return 'image/png'; + case 'pdf': + return 'application/pdf'; + // Add more cases for other file types as needed + default: + return 'application/octet-stream'; // Default MIME type + } + } + + + + + + + + late List> datagrid_fieldvdataFuture = + []; // Data from fetchData + + Future>> getdatagrid_fieldvGrid() async { + + try { + final value = await repo.getdatagrid_fieldvGrid(); + datagrid_fieldvdataFuture = (value as List) + .map((item) => item as Map) + .toList(); + + return datagrid_fieldvdataFuture; + } catch (e) { + throw Exception('Failed to get all: $e'); + } + } + +List> select_dyanamicItems = []; + + Future>> getselect_dyanamic() async { + + try { + final value = await repo.getselect_dyanamic(); + select_dyanamicItems = (value as List) + .map((item) => item as Map) + .toList(); + + return select_dyanamicItems; + } catch (e) { + throw Exception('Failed to get all: $e'); + } + } + +List> select_dynamic_mulItems = []; + + Future>> getselect_dynamic_mul() async { + + try { + final value = await repo.getselect_dynamic_mul(); + select_dynamic_mulItems = (value as List) + .map((item) => item as Map) + .toList(); + + return select_dynamic_mulItems; + } catch (e) { + throw Exception('Failed to get all: $e'); + } + } + +List> select_autocompItems = []; + + Future>> getselect_autocomp() async { + + try { + final value = await repo.getselect_autocomp(); + select_autocompItems = (value as List) + .map((item) => item as Map) + .toList(); + + return select_autocompItems; + } catch (e) { + throw Exception('Failed to get all: $e'); + } + } + +List> select_autcomp_mulItems = []; + + Future>> getselect_autcomp_mul() async { + + try { + final value = await repo.getselect_autcomp_mul(); + select_autcomp_mulItems = (value as List) + .map((item) => item as Map) + .toList(); + + return select_autcomp_mulItems; + } catch (e) { + throw Exception('Failed to get all: $e'); + } + } + +} \ No newline at end of file diff --git a/testflutterbugdt-demot1-f/authsec_flutter_new/base_project/lib/Entity/basic1/Testlist/TestlistView/Testlist_api_service.dart b/testflutterbugdt-demot1-f/authsec_flutter_new/base_project/lib/Entity/basic1/Testlist/TestlistView/Testlist_api_service.dart new file mode 100644 index 0000000..244a4c9 --- /dev/null +++ b/testflutterbugdt-demot1-f/authsec_flutter_new/base_project/lib/Entity/basic1/Testlist/TestlistView/Testlist_api_service.dart @@ -0,0 +1,84 @@ +import 'dart:typed_data'; +import 'package:dio/dio.dart'; +import 'package:http_parser/http_parser.dart'; +import '../../../../resources/api_constants.dart'; +import '../../../../data/network/base_network_service.dart'; +import '../../../../data/network/network_api_service.dart'; + +class TestlistApiService { + final String baseUrl = ApiConstants.baseUrl; + + final BaseNetworkService _helper = NetworkApiService(); + + + + Future>> getEntities() async { + + try { + final response = await _helper.getGetApiResponse('$baseUrl/Testlist/Testlist'); + final entities = (response as List).cast>(); + return entities; + } catch (e) { + throw Exception('Failed to get all entities: $e'); + } + } +Future>> getAllWithPagination( + int page, int size) async { + try { + final response = + await _helper.getGetApiResponse('$baseUrl/Testlist/Testlist/getall/page?page=$page&size=$size'); + final entities = + (response['content'] as List).cast>(); + return entities; + } catch (e) { + throw Exception('Failed to get all without pagination: $e'); + } + } + Future> createEntity( + Map entity) async { + try { + print("in post api$entity"); + final response = + await _helper.getPostApiResponse('$baseUrl/Testlist/Testlist', entity); + + print(entity); + + // Assuming the response is a Map + Map responseData = response; + + return responseData; + } catch (e) { + throw Exception('Failed to create entity: $e'); + } + } + + + + + + + + Future updateEntity( int entityId, Map entity) async { + try { + await _helper.getPutApiResponse('$baseUrl/Testlist/Testlist/$entityId', + entity); print(entity); + + } catch (e) { + throw Exception('Failed to update entity: $e'); + } + } + + Future deleteEntity( int entityId) async { + try { + await _helper.getDeleteApiResponse('$baseUrl/Testlist/Testlist/$entityId'); + } catch (e) { + throw Exception('Failed to delete entity: $e'); + } + } + + + + + + +} \ No newline at end of file diff --git a/testflutterbugdt-demot1-f/authsec_flutter_new/base_project/lib/Entity/basic1/Testlist/TestlistView/Testlist_create_entity_screen.dart b/testflutterbugdt-demot1-f/authsec_flutter_new/base_project/lib/Entity/basic1/Testlist/TestlistView/Testlist_create_entity_screen.dart new file mode 100644 index 0000000..cd402d4 --- /dev/null +++ b/testflutterbugdt-demot1-f/authsec_flutter_new/base_project/lib/Entity/basic1/Testlist/TestlistView/Testlist_create_entity_screen.dart @@ -0,0 +1,82 @@ +// ignore_for_file: use_build_context_synchronously +import 'dart:convert'; +import 'package:flutter/material.dart'; +import 'package:file_picker/file_picker.dart'; +import 'package:image_picker/image_picker.dart'; +import 'package:provider/provider.dart'; +import '../Testlist_viewModel/Testlist_view_model_screen.dart'; +import 'Testlist_fields.dart';import 'package:base_project/BuilderField/shared/ui/entity_screens.dart'; +import '../../../../utils/image_constant.dart'; +import '../../../../utils/size_utils.dart'; +import '../../../../theme/app_style.dart'; +import '../../../../widgets/app_bar/appbar_image.dart'; +import '../../../../widgets/app_bar/appbar_title.dart'; +import '../../../../widgets/app_bar/custom_app_bar.dart'; +import '../../../../widgets/custom_button.dart'; +import '../../../../widgets/custom_text_form_field.dart'; +import '../../../../widgets/custom_dropdown_field.dart'; +import 'dart:math'; +import 'package:qr_flutter/qr_flutter.dart'; +import 'package:barcode_widget/barcode_widget.dart'; +import 'package:intl/intl.dart'; + +import 'package:autocomplete_textfield/autocomplete_textfield.dart'; +import 'package:http/http.dart' as http; +import 'package:flutter/services.dart'; +import 'package:image_picker/image_picker.dart'; +import 'package:fluttertoast/fluttertoast.dart'; +import '../../../../Reuseable/reusable_date_picker_field.dart'; +import '../../../../Reuseable/reusable_date_time_picker_field.dart' +;import 'package:multi_select_flutter/multi_select_flutter.dart'; +import 'package:just_audio/just_audio.dart'; +import 'package:video_player/video_player.dart'; +import 'package:google_fonts/google_fonts.dart'; +import 'package:lottie/lottie.dart'; +import '../../../../utils/toast_messages/toast_message_util.dart'; +import 'dart:io'; +import '../../../../Reuseable/reusable_text_field.dart'; +import '../../../../Reuseable/reusable_dropdown_field.dart'; + + + + + + +class TestlistCreateEntityScreen extends StatefulWidget { + const TestlistCreateEntityScreen({super.key}); + + @override + _TestlistCreateEntityScreenState createState() => _TestlistCreateEntityScreenState(); +} + +class _TestlistCreateEntityScreenState extends State { + +final Map formData = {}; + final _formKey = GlobalKey(); + + @override + Widget build(BuildContext context) { + return Consumer( + builder: (context, viewModel, child) { + return EntityCreateScreen( + fields: TestlistFields.getFields(context), + onSubmit: (data) => _handleSubmit(data), + title: 'Testlist', + isLoading: viewModel.isLoading, + errorMessage: + viewModel.errorMessage.isNotEmpty ? viewModel.errorMessage : null, + ); + }, + ); + } + + Future _handleSubmit(Map formData) async { + final provider = + Provider.of(context, listen: false); + final success = await provider.createEntity(formData); + + if (success && mounted) { + Navigator.pop(context); + } + } +} \ No newline at end of file diff --git a/testflutterbugdt-demot1-f/authsec_flutter_new/base_project/lib/Entity/basic1/Testlist/TestlistView/Testlist_details_screen.dart b/testflutterbugdt-demot1-f/authsec_flutter_new/base_project/lib/Entity/basic1/Testlist/TestlistView/Testlist_details_screen.dart new file mode 100644 index 0000000..95c5db4 --- /dev/null +++ b/testflutterbugdt-demot1-f/authsec_flutter_new/base_project/lib/Entity/basic1/Testlist/TestlistView/Testlist_details_screen.dart @@ -0,0 +1,90 @@ +// ignore_for_file: use_build_context_synchronously +import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; +import '../../../../BuilderField/shared/ui/entity_details.dart'; +import '../Testlist_viewModel/Testlist_view_model_screen.dart'; +import 'Testlist_update_entity_screen.dart'; + +class TestlistDetailsScreen extends StatefulWidget { + final Map entity; + + const TestlistDetailsScreen({ + super.key, + required this.entity, + }); + + @override + State createState() => _TestlistDetailsScreenState(); +} + +class _TestlistDetailsScreenState extends State { + void _navigateToUpdateScreen(Map entity) { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => ChangeNotifierProvider( + create: (context) => TestlistViewModelScreen(), + child: TestlistUpdateEntityScreen(entity: entity), + ), + ), + ).then((_) { + // Refresh the details screen with updated data + setState(() {}); + }); + } + + void _showDeleteDialog(Map entity) { + showDialog( + context: context, + builder: (BuildContext context) { + return AlertDialog( + title: const Text('Confirm Deletion'), + content: const Text('Are you sure you want to delete this Testlist?'), + actions: [ + TextButton( + child: const Text('Cancel'), + onPressed: () { + Navigator.of(context).pop(); + }, + ), + TextButton( + child: const Text('Delete'), + onPressed: () async { + Navigator.of(context).pop(); + final vm = + Provider.of(context, listen: false); + final success = await vm.deleteEntity(entity['id']); + if (success && mounted) { + Navigator.pop(context); // Go back to list + } + }, + ), + ], + ); + }, + ); + } + + @override + Widget build(BuildContext context) { + return Consumer( + builder: (context, viewModel, child) { + return EntityDetails( + entity: widget.entity, + onEdit: (entity) => _navigateToUpdateScreen(entity), + onDelete: (entity) => _showDeleteDialog(entity), + title: 'Testlist', + displayFields: [ + {'key': 'name', 'label': 'Name', 'type': 'text'}, + + {'key': 'description', 'label': 'Description', 'type': 'textarea'}, + + {'key': 'active', 'label': 'Active', 'type': 'toggle_switch'}, + + ], + isLoading: viewModel.isLoading, + ); + }, + ); + } +} diff --git a/testflutterbugdt-demot1-f/authsec_flutter_new/base_project/lib/Entity/basic1/Testlist/TestlistView/Testlist_entity_list_screen.dart b/testflutterbugdt-demot1-f/authsec_flutter_new/base_project/lib/Entity/basic1/Testlist/TestlistView/Testlist_entity_list_screen.dart new file mode 100644 index 0000000..f2648d2 --- /dev/null +++ b/testflutterbugdt-demot1-f/authsec_flutter_new/base_project/lib/Entity/basic1/Testlist/TestlistView/Testlist_entity_list_screen.dart @@ -0,0 +1,150 @@ +// ignore_for_file: use_build_context_synchronously +import 'package:flutter/material.dart'; +import 'package:intl/intl.dart'; +import 'package:base_project/BuilderField/shared/ui/entity_list.dart'; +import 'Testlist_create_entity_screen.dart'; +import 'Testlist_update_entity_screen.dart'; +import '../Testlist_viewModel/Testlist_view_model_screen.dart'; +import 'Testlist_details_screen.dart';import 'package:flutter/services.dart'; +import 'package:speech_to_text/speech_to_text.dart' as stt; +import '../../../../theme/app_style.dart'; +import '../../../../utils/size_utils.dart'; +import '../../../../widgets/custom_icon_button.dart'; +import '../../../../utils/image_constant.dart'; +import '../../../../widgets/app_bar/appbar_image.dart'; +import '../../../../widgets/app_bar/appbar_title.dart'; +import '../../../../widgets/app_bar/custom_app_bar.dart'; +import '../../../../theme/app_decoration.dart'; +import 'package:multi_select_flutter/multi_select_flutter.dart'; +import '../../../../Reuseable/reusable_text_field.dart'; +import 'package:provider/provider.dart'; +import '../../../../utils/toast_messages/toast_message_util.dart'; +import 'package:fluttertoast/fluttertoast.dart'; + +class Testlist_entity_list_screen extends StatefulWidget { + static const String routeName = '/entity-list'; + + @override + _Testlist_entity_list_screenState createState() => _Testlist_entity_list_screenState(); +} + +class _Testlist_entity_list_screenState extends State { + @override + void initState() { + super.initState(); + _loadData(); + } + + void _loadData() { + WidgetsBinding.instance.addPostFrameCallback((_) { + if (mounted) { + final vm = Provider.of(context, listen: false); + vm.getAllWithPagination(refresh: true); + } + }); + } + + void _navigateToCreateScreen() { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => ChangeNotifierProvider( + create: (context) => TestlistViewModelScreen(), + child: const TestlistCreateEntityScreen(), + ), + ), + ).then((_) { + final vm = Provider.of(context, listen: false); + vm.refreshData(); + }); + } + + void _navigateToUpdateScreen(Map entity) { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => ChangeNotifierProvider( + create: (context) => TestlistViewModelScreen(), + child: TestlistUpdateEntityScreen(entity: entity), + ), + ), + ).then((_) { + final vm = Provider.of(context, listen: false); + vm.refreshData(); + }); + } + + void _navigateToDetailsScreen(Map entity) { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => ChangeNotifierProvider( + create: (context) => TestlistViewModelScreen(), + child: TestlistDetailsScreen(entity: entity), + ), + ), + ); + } + + void _showDeleteDialog(Map entity) { + final parentContext = context; + showDialog( + context: context, + builder: (BuildContext context) { + return AlertDialog( + title: const Text('Confirm Deletion'), + content: const Text('Are you sure you want to delete this Testlist?'), + actions: [ + TextButton( + child: const Text('Cancel'), + onPressed: () { + Navigator.of(context).pop(); + }, + ), + TextButton( + child: const Text('Delete'), + onPressed: () async { + Navigator.of(context).pop(); + final vm = + Provider.of(parentContext, listen: false); + await vm.deleteEntity(entity['id']); + }, + ), + ], + ); + }, + ); + } + + @override + Widget build(BuildContext context) { + return Consumer( + builder: (context, viewModel, child) { + return EntityList( + entities: viewModel.filteredList, + isLoading: viewModel.isLoading, + errorMessage: + viewModel.errorMessage.isNotEmpty ? viewModel.errorMessage : null, + hasMoreData: viewModel.hasMoreData, + searchQuery: viewModel.searchQuery, + onSearchChanged: (query) => viewModel.searchtestlist(query), + onEdit: (entity) => _navigateToUpdateScreen(entity), + onDelete: (entity) => _showDeleteDialog(entity), + onTap: (entity) => _navigateToDetailsScreen(entity), + onRefresh: () => viewModel.refreshData(), + onLoadMore: () => viewModel.getAllWithPagination(), + title: 'Testlist', + onAddNew: _navigateToCreateScreen, + displayFields: [ + {'key': 'name', 'label': 'Name', 'type': 'text'}, + + {'key': 'description', 'label': 'Description', 'type': 'textarea'}, + + {'key': 'active', 'label': 'Active', 'type': 'toggle_switch'}, + + ], + ); + }, + ); + } +} diff --git a/testflutterbugdt-demot1-f/authsec_flutter_new/base_project/lib/Entity/basic1/Testlist/TestlistView/Testlist_fields.dart b/testflutterbugdt-demot1-f/authsec_flutter_new/base_project/lib/Entity/basic1/Testlist/TestlistView/Testlist_fields.dart new file mode 100644 index 0000000..0c0cc2f --- /dev/null +++ b/testflutterbugdt-demot1-f/authsec_flutter_new/base_project/lib/Entity/basic1/Testlist/TestlistView/Testlist_fields.dart @@ -0,0 +1,76 @@ +import 'package:base_project/BuilderField/shared/fields/number_field.dart'; +import 'package:base_project/BuilderField/shared/fields/password_field.dart'; +import 'package:base_project/BuilderField/shared/fields/phone_field.dart'; +import 'package:base_project/BuilderField/shared/fields/custom_text_field.dart'; + +import '../../../../BuilderField/shared/fields/base_field.dart'; + +import '../../../../BuilderField/shared/fields/date_field.dart'; +import '../../../../BuilderField/shared/fields/datetime_field.dart'; +import '../../../../BuilderField/shared/fields/email_field.dart'; +import 'package:base_project/BuilderField/shared/fields/url_field.dart'; +import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; + +import '../../../../BuilderField/shared/fields/custom_text_field.dart' as shared_text; +import '../../../../BuilderField/shared/fields/one_to_one_relation_field.dart'; +import '../../../../BuilderField/shared/fields/calculated_field.dart'; +import '../../../../BuilderField/shared/fields/one_to_many_field.dart'; +import '../../../../BuilderField/shared/fields/value_list_picker_field.dart'; +import '../../../../BuilderField/shared/fields/captcha_field.dart'; +import '../../../../BuilderField/shared/fields/switch_field.dart'; +import '../../../../BuilderField/shared/fields/url_field.dart'; + +import '../../../../BuilderField/shared/fields/audio_upload_field.dart'; +import '../../../../BuilderField/shared/fields/checkbox_field.dart'; +import '../../../../BuilderField/shared/fields/file_upload_field.dart'; +import '../../../../BuilderField/shared/fields/image_upload_field.dart'; +import '../../../../BuilderField/shared/fields/radio_field.dart'; +import '../../../../BuilderField/shared/fields/video_upload_field.dart'; + +import '../../../../BuilderField/shared/fields/autocomplete_dropdown_field.dart'; +import '../../../../BuilderField/shared/fields/autocomplete_multiselect_field.dart'; +import '../../../../BuilderField/shared/fields/one_to_one_relation_field.dart'; +import '../../../../BuilderField/shared/fields/data_grid_field.dart'; +import '../../../../BuilderField/shared/fields/dropdown_field.dart'; +import '../../../../BuilderField/shared/fields/dynamic_dropdown_field.dart'; +import '../../../../BuilderField/shared/fields/dynamic_multiselect_dropdown_field.dart'; +import '../../../../BuilderField/shared/fields/static_multiselect_field.dart'; +import '../../../../BuilderField/shared/fields/currency_field.dart'; +import '../../../../BuilderField/shared/fields/field_group_field.dart'; +import '../../../../BuilderField/shared/fields/qr_code_field.dart'; +import '../../../../BuilderField/shared/fields/barcode_field.dart'; +import '../../../../BuilderField/shared/fields/dependent_dropdown_field.dart'; + import '../Testlist_viewModel/Testlist_view_model_screen.dart';/// Field definitions for Testlist entity +/// This defines the structure and validation for Testlist forms +class TestlistFields { + /// Get field definitions for Testlist entity + static List getFields(BuildContext context) { + final viewModel = + Provider.of(context, listen: false); + return [ + // Basic Information + CustomTextField( + fieldKey: 'name', + label: 'Name', + hint: 'Enter Name', + isRequired: true, + maxLength: 50, + ), + +CustomTextField( + fieldKey: 'description', + label: 'Description', + hint: 'Enter Description', + isRequired: false, + maxLength: 1000, + ), + + SwitchField( + fieldKey: 'active', + label: 'Active', + ), + + ]; + } +} diff --git a/testflutterbugdt-demot1-f/authsec_flutter_new/base_project/lib/Entity/basic1/Testlist/TestlistView/Testlist_update_entity_screen.dart b/testflutterbugdt-demot1-f/authsec_flutter_new/base_project/lib/Entity/basic1/Testlist/TestlistView/Testlist_update_entity_screen.dart new file mode 100644 index 0000000..4e2b158 --- /dev/null +++ b/testflutterbugdt-demot1-f/authsec_flutter_new/base_project/lib/Entity/basic1/Testlist/TestlistView/Testlist_update_entity_screen.dart @@ -0,0 +1,77 @@ +// ignore_for_file: use_build_context_synchronously +import 'dart:convert'; +import 'package:provider/provider.dart'; +import '../Testlist_viewModel/Testlist_view_model_screen.dart'; +import 'package:base_project/BuilderField/shared/ui/entity_screens.dart'; +import 'Testlist_fields.dart';import '../../../../utils/image_constant.dart'; +import '../../../../utils/size_utils.dart'; +import '../../../../theme/app_style.dart'; +import '../../../../widgets/app_bar/appbar_image.dart'; +import '../../../../widgets/app_bar/appbar_title.dart'; +import '../../../../widgets/app_bar/custom_app_bar.dart'; +import 'package:barcode_widget/barcode_widget.dart'; +import 'package:fluttertoast/fluttertoast.dart'; +import '../../../../widgets/custom_button.dart'; +import '../../../../widgets/custom_text_form_field.dart'; +import 'package:flutter/material.dart'; +import 'package:autocomplete_textfield/autocomplete_textfield.dart'; +import 'package:qr_flutter/qr_flutter.dart'; +import 'package:intl/intl.dart'; + +import 'dart:math'; +import '../../../../Reuseable/reusable_text_field.dart'; +import '../../../../Reuseable/reusable_date_picker_field.dart'; +import '../../../../Reuseable/reusable_date_time_picker_field.dart'; +import '../../../../Reuseable/reusable_dropdown_field.dart'; +import 'package:flutter/services.dart'; +class TestlistUpdateEntityScreen extends StatefulWidget { + final Map entity; + + + TestlistUpdateEntityScreen({required this.entity}); + + @override + _TestlistUpdateEntityScreenState createState() => _TestlistUpdateEntityScreenState(); +} + +class _TestlistUpdateEntityScreenState extends State { + final _formKey = GlobalKey(); + +@override + Widget build(BuildContext context) { + return Consumer( + builder: (context, viewModel, child) { +// Start with all fields, then remove upload fields (generic filter by keys) + final Set hiddenKeys = { + + + + + + + }; + final fields = TestlistFields.getFields(context) + .where((f) => !hiddenKeys.contains(f.fieldKey)) + .toList(); return EntityUpdateScreen( + fields: fields, + initialData: widget.entity, + onSubmit: (data) => _handleSubmit(data), + title: 'Testlist', + isLoading: viewModel.isLoading, + errorMessage: + viewModel.errorMessage.isNotEmpty ? viewModel.errorMessage : null, + ); + }, + ); + } + + Future _handleSubmit(Map formData) async { + final provider = + Provider.of(context, listen: false); + final success = await provider.updateEntity(widget.entity['id'], formData); + + if (success && mounted) { + Navigator.pop(context); + } + } +} diff --git a/testflutterbugdt-demot1-f/authsec_flutter_new/base_project/lib/Entity/basic1/Testlist/Testlist_Repo/Testlist_repo_screen.dart b/testflutterbugdt-demot1-f/authsec_flutter_new/base_project/lib/Entity/basic1/Testlist/Testlist_Repo/Testlist_repo_screen.dart new file mode 100644 index 0000000..14a2969 --- /dev/null +++ b/testflutterbugdt-demot1-f/authsec_flutter_new/base_project/lib/Entity/basic1/Testlist/Testlist_Repo/Testlist_repo_screen.dart @@ -0,0 +1,95 @@ +import 'package:dio/dio.dart'; +import '../../../../data/network/base_network_service.dart'; +import '../../../../data/network/network_api_service.dart'; +import '../../../../resources/api_constants.dart'; +import 'package:base_project/data/response/api_response.dart'; + +class TestlistRepoScreen { + + final String baseUrl = ApiConstants.baseUrl; + final BaseNetworkService _helper = NetworkApiService(); + final String _endpointPath = '/Testlist/Testlist'; + + Future>>> getEntities() async { + try { + final response = + await _helper.getGetApiResponse('$baseUrl$_endpointPath'); + print('Response received: $response'); + List> entities = const []; + if (response is List) { + entities = response + .whereType() + .map((e) => Map.from(e as Map)) + .toList(); + } else if (response is Map) { + final dynamic content = response['content']; + if (content is List) { + entities = content + .whereType() + .map((e) => Map.from(e as Map)) + .toList(); + } + } + return ApiResponse.success(entities); + } catch (e) { + print(' error got $e'); + return ApiResponse.error('Failed to get all entities: $e'); + } + } + + Future>>> getAllWithPagination( + int page, int size) async { + try { + final response = await _helper.getGetApiResponse( + '$baseUrl$_endpointPath/getall/page?page=$page&size=$size'); + + if (response is Map && response['content'] is List) { + final List> entities = + (response['content'] as List).cast>().toList(); + return ApiResponse.success(entities); + } else { + return ApiResponse.error('Invalid response format'); + } + } catch (e) { + return ApiResponse.error('Failed to get all without pagination: $e'); + } + } + + Future>> createEntity( + Map entity) async { + try { + print("in post api$entity"); + final response = + await _helper.getPostApiResponse('$baseUrl$_endpointPath', entity); + return ApiResponse.success(response as Map); + } catch (e) { + return ApiResponse.error('Failed to create entity: $e'); + } + } + + Future>> updateEntity( + int entityId, Map entity) async { + try { + final response = await _helper.getPutApiResponse( + '$baseUrl$_endpointPath/$entityId', entity); + return ApiResponse.success(response as Map); + } catch (e) { + return ApiResponse.error('Failed to update entity: $e'); + } + } + + Future> deleteEntity(int entityId) async { + try { + await _helper.getDeleteApiResponse('$baseUrl$_endpointPath/$entityId'); + return ApiResponse.success(null); + } catch (e) { + return ApiResponse.error('Failed to delete entity: $e'); + } + } + + + + + + +} diff --git a/testflutterbugdt-demot1-f/authsec_flutter_new/base_project/lib/Entity/basic1/Testlist/Testlist_viewModel/Testlist_view_model_screen.dart b/testflutterbugdt-demot1-f/authsec_flutter_new/base_project/lib/Entity/basic1/Testlist/Testlist_viewModel/Testlist_view_model_screen.dart new file mode 100644 index 0000000..59994b1 --- /dev/null +++ b/testflutterbugdt-demot1-f/authsec_flutter_new/base_project/lib/Entity/basic1/Testlist/Testlist_viewModel/Testlist_view_model_screen.dart @@ -0,0 +1,305 @@ +import 'package:base_project/data/response/status.dart'; +import 'dart:typed_data'; +import 'package:dio/dio.dart'; +import 'package:http_parser/http_parser.dart'; +import '../../../../utils/toast_messages/toast_message_util.dart'; +import '../../../../BuilderField/shared/utils/entity_field_store.dart'; +import 'package:flutter/material.dart'; +import '../Testlist_Repo/Testlist_repo_screen.dart'; + +class TestlistViewModelScreen extends ChangeNotifier{ + final TestlistRepoScreen repo = TestlistRepoScreen(); + + + // State variables + List> _testlistList = []; + List> _filteredList = []; + bool _isLoading = false; + String _errorMessage = ''; + int _currentPage = 0; + int _pageSize = 10; + bool _hasMoreData = true; + String _searchQuery = ''; + + // Getters + List> get testlistList => _testlistList; + List> get filteredList => _filteredList; + bool get isLoading => _isLoading; + String get errorMessage => _errorMessage; + bool get hasMoreData => _hasMoreData; + String get searchQuery => _searchQuery; + + // Set loading state + void _setLoading(bool loading) { + _isLoading = loading; + notifyListeners(); + } + + // Set error message + void _setError(String error) { + _errorMessage = error; + notifyListeners(); + } + + // Clear error + void clearError() { + _errorMessage = ''; + notifyListeners(); + } + + // Get testlist list + Future getEntities() async { + _setLoading(true); + _setError(''); + + try { + final response = await repo.getEntities(); + + if (response.status == Status.SUCCESS) { + _testlistList = response.data ?? []; + _filteredList = List.from(_testlistList); + _currentPage = 0; + _hasMoreData = true; + } else { + _setError(response.message ?? 'Failed to fetch testlist list'); + } + } catch (e) { + _setError('Failed to fetch testlist list: $e'); + } finally { + _setLoading(false); + } + } + + // Get testlist list with pagination + Future getAllWithPagination({bool refresh = false}) async { + if (refresh) { + _currentPage = 0; + _testlistList.clear(); + _filteredList.clear(); + _hasMoreData = true; + } + + if (!_hasMoreData || _isLoading) return; + + _setLoading(true); + _setError(''); + + try { + final response = await repo.getAllWithPagination(_currentPage, _pageSize); + + if (response.status == Status.SUCCESS) { + final newItems = response.data ?? []; + + if (refresh) { + _testlistList = newItems; + } else { + _testlistList.addAll(newItems); + } + + _filteredList = List.from(_testlistList); + _currentPage++; + + // Check if we have more data + _hasMoreData = newItems.length == _pageSize; + } else { + _setError(response.message ?? 'Failed to fetch Testlist list'); + } + } catch (e) { + _setError('Failed to fetch testlist list: $e'); + } finally { + _setLoading(false); + } + } + + + + + + + + // Create Testlist + Future createEntity(Map entity) async { + _setLoading(true); + _setError(''); + + try { + + + + + + + final response = await repo.createEntity(entity); + + if (response.status == Status.SUCCESS) { +// Get the response ID for image upload + + final responseId = response.data!['id'].toString(); + + + + + + + ToastMessageUtil.showToast( + message: 'testlist created successfully', + toastType: ToastType.success, + ); + + // Refresh the list + await getEntities(); + + + + + + + return true; + } else { + _setError(response.message ?? 'Failed to create Testlist'); + ToastMessageUtil.showToast( + message: response.message ?? 'Failed to create Testlist', + toastType: ToastType.error, + ); + return false; + } + } catch (e) { + _setError('Failed to create testlist: $e'); + ToastMessageUtil.showToast( + message: 'Failed to create Testlist: $e', + toastType: ToastType.error, + ); + return false; + } finally { + _setLoading(false); + } + } + + // Update testlist + Future updateEntity(int id, Map entity) async { + _setLoading(true); + _setError(''); + + try { + final response = await repo.updateEntity(id, entity); + + if (response.status == Status.SUCCESS) { + ToastMessageUtil.showToast( + message: 'Testlist updated successfully', + toastType: ToastType.success, + ); + + // Update the item in the list + final index = _testlistList.indexWhere((item) => item['id'] == id); + if (index != -1) { + _testlistList[index] = response.data!; + _filteredList = List.from(_testlistList); + notifyListeners(); + } + return true; + } else { + _setError(response.message ?? 'Failed to update Testlist'); + ToastMessageUtil.showToast( + message: response.message ?? 'Failed to update Testlist', + toastType: ToastType.error, + ); + return false; + } + } catch (e) { + _setError('Failed to update testlist: $e'); + ToastMessageUtil.showToast( + message: 'Failed to update Testlist: $e', + toastType: ToastType.error, + ); + return false; + } finally { + _setLoading(false); + } + } + + // Delete testlist + Future deleteEntity(int id) async { + _setLoading(true); + _setError(''); + + try { + final response = await repo.deleteEntity(id); + + if (response.status == Status.SUCCESS) { + ToastMessageUtil.showToast( + message: 'Testlist deleted successfully', + toastType: ToastType.success, + ); + + // Remove the item from the list + _testlistList.removeWhere((item) => item['id'] == id); + _filteredList = List.from(_testlistList); + notifyListeners(); + return true; + } else { + _setError(response.message ?? 'Failed to delete Testlist'); + ToastMessageUtil.showToast( + message: response.message ?? 'Failed to delete Testlist', + toastType: ToastType.error, + ); + return false; + } + } catch (e) { + _setError('Failed to delete testlist: $e'); + ToastMessageUtil.showToast( + message: 'Failed to delete Testlist: $e', + toastType: ToastType.error, + ); + return false; + } finally { + _setLoading(false); + } + } + + // Search testlist + void searchtestlist(String query) { + _searchQuery = query; + + if (query.isEmpty) { + _filteredList = List.from(_testlistList); + } else { + _filteredList = _testlistList.where((item) { + return + + +(item['name']?.toString().toLowerCase().contains(query.toLowerCase()) ??false) || + + + + + +(item['description']?.toString().toLowerCase().contains(query.toLowerCase()) ??false) || + + +(item['active']?.toString().toLowerCase().contains(query.toLowerCase()) ??false) + + +; + }).toList(); + } + notifyListeners(); + } + + // Clear search + void clearSearch() { + _searchQuery = ''; + _filteredList = List.from(_testlistList); + notifyListeners(); + } + + // Refresh data + Future refreshData() async { + await getAllWithPagination(refresh: true); + } + + + + + + +} \ No newline at end of file diff --git a/testflutterbugdt-demot1-f/authsec_flutter_new/base_project/lib/view/dashboard/home.dart b/testflutterbugdt-demot1-f/authsec_flutter_new/base_project/lib/view/dashboard/home.dart index f640e18..698eddf 100644 --- a/testflutterbugdt-demot1-f/authsec_flutter_new/base_project/lib/view/dashboard/home.dart +++ b/testflutterbugdt-demot1-f/authsec_flutter_new/base_project/lib/view/dashboard/home.dart @@ -1,3 +1,9 @@ +import '../../Entity/basic1/Testlist/TestlistView/Testlist_entity_list_screen.dart'; +import '../../Entity/basic1/Testlist/Testlist_viewModel/Testlist_view_model_screen.dart'; + +import '../../Entity/basic1/Testbug/TestbugView/Testbug_entity_list_screen.dart'; +import '../../Entity/basic1/Testbug/Testbug_viewModel/Testbug_view_model_screen.dart'; + import 'package:base_project/core/constants/ui_constants.dart'; import 'package:base_project/core/theme/color_scheme.dart'; import 'package:base_project/routes/route_names.dart'; @@ -11,595 +17,629 @@ import 'package:base_project/view_model/system_params/system_params_view_model.d import 'package:flutter/material.dart'; class HomeView extends StatefulWidget { - const HomeView({super.key}); +const HomeView({super.key}); - @override - State createState() => _HomeViewState(); +@override +State createState() => _HomeViewState(); } class _HomeViewState extends State with TickerProviderStateMixin { - // Animation Controllers - late AnimationController _pageAnimationController; - late AnimationController _cardsAnimationController; - late AnimationController _actionsAnimationController; +// Animation Controllers +late AnimationController _pageAnimationController; +late AnimationController _cardsAnimationController; +late AnimationController _actionsAnimationController; - // Animations - late Animation _pageFadeAnimation; - late Animation _pageSlideAnimation; - late Animation _cardsScaleAnimation; - late Animation _actionsScaleAnimation; +// Animations +late Animation _pageFadeAnimation; +late Animation _pageSlideAnimation; +late Animation _cardsScaleAnimation; +late Animation _actionsScaleAnimation; - // Dashboard stats (replace with real API data) - List> _dashboardStats = []; +// Dashboard stats (replace with real API data) +List> _dashboardStats = []; - final List> _quickActions = [ - { - 'label': 'Profile', - 'icon': Icons.person, - 'onTap': () {}, - 'backgroundColor': null, // Use theme default - }, - { - 'label': 'Settings', - 'icon': Icons.settings, - 'onTap': () {}, - 'backgroundColor': null, - }, - { - 'label': 'Security', - 'icon': Icons.security, - 'onTap': () {}, - 'backgroundColor': null, - }, - { - 'label': 'Reports', - 'icon': Icons.analytics, - 'onTap': () {}, - 'backgroundColor': null, - }, - ]; +final List> _quickActions = [ +{ +'label': 'Profile', +'icon': Icons.person, +'onTap': () {}, +'backgroundColor': null, // Use theme default +}, +{ +'label': 'Settings', +'icon': Icons.settings, +'onTap': () {}, +'backgroundColor': null, +}, +{ +'label': 'Security', +'icon': Icons.security, +'onTap': () {}, +'backgroundColor': null, +}, +{ +'label': 'Reports', +'icon': Icons.analytics, +'onTap': () {}, +'backgroundColor': null, +}, +]; - final List _drawerItems = [ - DrawerItem( - icon: Icons.person, - title: 'Profile', - subtitle: 'Manage your account', - onTap: (context) { - Navigator.pushNamed(context, RouteNames.profileView); - }, - ), - DrawerItem( - icon: Icons.system_security_update, - title: 'System Parameters', - subtitle: 'Configure system settings', - onTap: (context) { - Navigator.pushNamed(context, RouteNames.systemParamsView); - }, - ), - DrawerItem( - icon: Icons.password, - title: 'Change Password', - subtitle: 'Update your password', - onTap: (context) { - Navigator.pushNamed(context, RouteNames.changePasswordView); - }, +final List _drawerItems = [ +DrawerItem( +icon: Icons.person, +title: 'Profile', +subtitle: 'Manage your account', +onTap: (context) { +Navigator.pushNamed(context, RouteNames.profileView); +}, +), +DrawerItem( +icon: Icons.system_security_update, +title: 'System Parameters', +subtitle: 'Configure system settings', +onTap: (context) { +Navigator.pushNamed(context, RouteNames.systemParamsView); +}, +), +DrawerItem( +icon: Icons.password, +title: 'Change Password', +subtitle: 'Update your password', +onTap: (context) { +Navigator.pushNamed(context, RouteNames.changePasswordView); +}, +), + +// NEW ITEMS + +// NEW MENU + DrawerItem( + icon: Icons.data_object, + title: 'Testlist Management', + subtitle: 'Manage Testlist entities', + onTap: (context) { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => ChangeNotifierProvider( + create: (context) => TestlistViewModelScreen(), + child: Testlist_entity_list_screen(), + ), + ), + ); + }, ), - // NEW ITEMS +DrawerItem( +icon: Icons.data_object, +title: 'Testbug Management', +subtitle: 'Manage Testbug entities', +onTap: (context) { +Navigator.push( +context, +MaterialPageRoute( +builder: (context) => ChangeNotifierProvider( +create: (context) => TestbugViewModelScreen(), +child: Testbug_entity_list_screen(), +), +), +); +}, +), - // NEW MENU - ]; +]; - @override - void initState() { - super.initState(); - _initializeAnimations(); - _startPageAnimation(); - _loadDashboardData(); - } - - void _initializeAnimations() { - // Page Animation Controller - _pageAnimationController = AnimationController( - duration: UIConstants.durationSlow, - vsync: this, - ); - - // Cards Animation Controller - _cardsAnimationController = AnimationController( - duration: UIConstants.durationNormal, - vsync: this, - ); - - // Actions Animation Controller - _actionsAnimationController = AnimationController( - duration: UIConstants.durationNormal, - vsync: this, - ); - - // Page Animations - _pageFadeAnimation = Tween(begin: 0.0, end: 1.0).animate( - CurvedAnimation( - parent: _pageAnimationController, - curve: UIConstants.curveNormal, - ), - ); - - _pageSlideAnimation = - Tween(begin: const Offset(0, 0.3), end: Offset.zero).animate( - CurvedAnimation( - parent: _pageAnimationController, - curve: UIConstants.curveNormal, - ), - ); - - // Cards Animations - _cardsScaleAnimation = Tween(begin: 0.8, end: 1.0).animate( - CurvedAnimation( - parent: _cardsAnimationController, - curve: UIConstants.curveElastic, - ), - ); - - // Actions Animations - _actionsScaleAnimation = Tween(begin: 0.8, end: 1.0).animate( - CurvedAnimation( - parent: _actionsAnimationController, - curve: UIConstants.curveElastic, - ), - ); - } - - void _startPageAnimation() async { - await Future.delayed(const Duration(milliseconds: 300)); - _pageAnimationController.forward(); - - await Future.delayed(const Duration(milliseconds: 400)); - _cardsAnimationController.forward(); - - await Future.delayed(const Duration(milliseconds: 300)); - _actionsAnimationController.forward(); - } - - Future _loadDashboardData() async { - // TODO: replace with actual API calls, e.g., via a DashboardViewModel - // Simulate network delay - await Future.delayed(const Duration(milliseconds: 400)); - - setState(() { - _dashboardStats = [ - { - 'title': 'Total Users', - 'subtitle': 'Active accounts', - 'numericValue': 1234, - 'valueSuffix': '', - 'icon': Icons.people, - 'type': DashboardCardType.primary, - 'onTap': () {}, - }, - { - 'title': 'System Uptime', - 'subtitle': 'All systems operational', - 'numericValue': 99.9, - 'valueSuffix': '%', - 'icon': Icons.check_circle, - 'type': DashboardCardType.success, - 'onTap': () {}, - }, - { - 'title': 'Security Alerts', - 'subtitle': 'Last 24 hours', - 'numericValue': 2, - 'valueSuffix': '', - 'icon': Icons.security, - 'type': DashboardCardType.info, - 'onTap': () {}, - }, - { - 'title': 'Avg. Response Time', - 'subtitle': 'System performance', - 'numericValue': 2.3, - 'valueSuffix': 's', - 'icon': Icons.speed, - 'type': DashboardCardType.secondary, - 'onTap': () {}, - }, - ]; - }); - } - - @override - void dispose() { - _pageAnimationController.dispose(); - _cardsAnimationController.dispose(); - _actionsAnimationController.dispose(); - super.dispose(); - } - - @override - Widget build(BuildContext context) { - final theme = Theme.of(context); - final colorScheme = theme.colorScheme; - final size = MediaQuery.of(context).size; - final userName = UserManager().userName; - - return Scaffold( - backgroundColor: colorScheme.background, - appBar: ModernAppBar( - title: 'Dashboard', - centerTitle: false, - showLogoInTitle: true, - logoImage: _getDashboardLogoImage(colorScheme), - userAvatar: null, - userAvatarImage: _getDashboardLogoImage(colorScheme), - userName: userName, - onProfilePressed: () { - Navigator.pushNamed(context, RouteNames.profileView); - }, - ), - drawer: ModernDrawer(items: _drawerItems), - body: Container( - decoration: BoxDecoration( - gradient: LinearGradient( - begin: Alignment.topLeft, - end: Alignment.bottomRight, - colors: [ - colorScheme.background, - colorScheme.surfaceVariant.withOpacity(0.1), - colorScheme.primaryContainer.withOpacity(0.05), - ], - ), - ), - child: SafeArea( - child: SingleChildScrollView( - padding: UIConstants.getResponsivePadding( - context, - mobile: const EdgeInsets.all(UIConstants.spacing24), - tablet: const EdgeInsets.all(UIConstants.spacing32), - desktop: const EdgeInsets.all(UIConstants.spacing40), - ), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - // Welcome Section - _buildWelcomeSection(theme, colorScheme, userName), - - SizedBox( - height: UIConstants.getResponsiveSpacing( - context, - mobile: UIConstants.spacing32, - tablet: UIConstants.spacing40, - desktop: UIConstants.spacing48, - ), - ), - - // Dashboard Stats - _buildDashboardStats(theme, colorScheme), - - SizedBox( - height: UIConstants.getResponsiveSpacing( - context, - mobile: UIConstants.spacing40, - tablet: UIConstants.spacing56, - desktop: UIConstants.spacing72, - ), - ), - - // Quick Actions - _buildQuickActions(theme, colorScheme), - - SizedBox( - height: UIConstants.getResponsiveSpacing( - context, - mobile: UIConstants.spacing40, - tablet: UIConstants.spacing56, - desktop: UIConstants.spacing72, - ), - ), - - // Recent Activity Section - _buildRecentActivity(theme, colorScheme), - ], - ), - ), - ), - ), - ); - } - - ImageProvider? _getDashboardLogoImage(ColorScheme cs) { - // Prefer dynamic logo from system parameters if present - try { - final sysVm = Provider.of(context, listen: true); - if (sysVm.profileImageBytes != null && - sysVm.profileImageBytes!.isNotEmpty) { - return MemoryImage(sysVm.profileImageBytes!); - } - } catch (_) { - // Provider not available – fall through to default asset - } - - // Default asset logo - return const AssetImage('assets/images/image_not_found.png'); - } - - Widget _buildWelcomeSection( - ThemeData theme, - ColorScheme colorScheme, - String? userName, - ) { - return AnimatedBuilder( - animation: _pageAnimationController, - builder: (context, child) { - return FadeTransition( - opacity: _pageFadeAnimation, - child: SlideTransition( - position: _pageSlideAnimation, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - 'Welcome back, ${userName ?? 'User'}! 👋', - style: theme.textTheme.headlineMedium?.copyWith( - color: colorScheme.onBackground, - fontWeight: FontWeight.w700, - ), - maxLines: 1, - overflow: TextOverflow.ellipsis, - ), - const SizedBox(height: UIConstants.spacing8), - Text( - 'Here\'s what\'s happening with your system today', - style: theme.textTheme.bodyLarge?.copyWith( - color: colorScheme.onSurfaceVariant, - ), - maxLines: 2, - overflow: TextOverflow.ellipsis, - ), - ], - ), - ), - ); - }, - ); - } - - // Removed in-body logo: AppBar now displays the logo. - - Widget _buildDashboardStats(ThemeData theme, ColorScheme colorScheme) { - return AnimatedBuilder( - animation: _cardsAnimationController, - builder: (context, child) { - return Transform.scale( - scale: _cardsScaleAnimation.value, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - 'System Overview', - style: theme.textTheme.titleLarge?.copyWith( - color: colorScheme.onBackground, - fontWeight: FontWeight.w600, - ), - ), - const SizedBox(height: UIConstants.spacing24), - - // Responsive Grid - LayoutBuilder( - builder: (context, constraints) { - final crossAxisCount = UIConstants.isMobile(context) - ? 2 - : UIConstants.isTablet(context) - ? 3 - : 4; - - // Use fixed mainAxisExtent per breakpoint to avoid overflow - final double mainAxisExtent = UIConstants.isMobile(context) - ? 130 - : (UIConstants.isTablet(context) ? 160 : 180); - - return GridView.builder( - shrinkWrap: true, - physics: const NeverScrollableScrollPhysics(), - gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( - crossAxisCount: crossAxisCount, - crossAxisSpacing: UIConstants.spacing16, - mainAxisSpacing: UIConstants.spacing16, - mainAxisExtent: mainAxisExtent, - ), - itemCount: _dashboardStats.length, - itemBuilder: (context, index) { - final stat = _dashboardStats[index]; - return DashboardCard( - title: stat['title'], - subtitle: stat['subtitle'], - value: stat['value'], - numericValue: stat['numericValue'], - valueSuffix: stat['valueSuffix'], - animationDuration: UIConstants.durationNormal, - icon: stat['icon'], - type: stat['type'], - onTap: stat['onTap'], - ); - }, - ); - }, - ), - ], - ), - ); - }, - ); - } - - Widget _buildQuickActions(ThemeData theme, ColorScheme colorScheme) { - return AnimatedBuilder( - animation: _actionsAnimationController, - builder: (context, child) { - return Transform.scale( - scale: _actionsScaleAnimation.value, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - 'Quick Actions', - style: theme.textTheme.titleLarge?.copyWith( - color: colorScheme.onBackground, - fontWeight: FontWeight.w600, - ), - ), - const SizedBox(height: UIConstants.spacing24), - - // Responsive Grid - LayoutBuilder( - builder: (context, constraints) { - final crossAxisCount = UIConstants.isMobile(context) - ? 2 - : UIConstants.isTablet(context) - ? 4 - : 6; - - return GridView.builder( - shrinkWrap: true, - physics: const NeverScrollableScrollPhysics(), - gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( - crossAxisCount: crossAxisCount, - crossAxisSpacing: UIConstants.spacing16, - mainAxisSpacing: UIConstants.spacing16, - childAspectRatio: 1.0, - ), - itemCount: _quickActions.length, - itemBuilder: (context, index) { - final action = _quickActions[index]; - return QuickActionButton( - label: action['label'], - icon: action['icon'], - onTap: action['onTap'], - backgroundColor: action['backgroundColor'], - size: UIConstants.logoSizeMedium, - ); - }, - ); - }, - ), - ], - ), - ); - }, - ); - } - - Widget _buildRecentActivity(ThemeData theme, ColorScheme colorScheme) { - return Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - 'Recent Activity', - style: theme.textTheme.titleLarge?.copyWith( - color: colorScheme.onBackground, - fontWeight: FontWeight.w600, - ), - ), - const SizedBox(height: UIConstants.spacing24), - Container( - padding: UIConstants.cardPaddingMedium, - decoration: BoxDecoration( - color: colorScheme.surface, - borderRadius: BorderRadius.circular(UIConstants.radius16), - boxShadow: [ - BoxShadow( - color: colorScheme.shadow.withOpacity(0.1), - blurRadius: 8, - offset: const Offset(0, 2), - ), - ], - ), - child: Column( - children: [ - _buildActivityItem( - theme, - colorScheme, - Icons.security, - 'Security scan completed', - 'System security check finished successfully', - '2 minutes ago', - AppColorScheme.success, - ), - const Divider(height: UIConstants.spacing24), - _buildActivityItem( - theme, - colorScheme, - Icons.update, - 'System updated', - 'Latest security patches installed', - '1 hour ago', - AppColorScheme.info, - ), - const Divider(height: UIConstants.spacing24), - _buildActivityItem( - theme, - colorScheme, - Icons.backup, - 'Backup completed', - 'Daily backup process finished', - '3 hours ago', - colorScheme.primary, - ), - ], - ), - ), - ], - ); - } - - Widget _buildActivityItem( - ThemeData theme, - ColorScheme colorScheme, - IconData icon, - String title, - String subtitle, - String time, - Color iconColor, - ) { - return Row( - children: [ - Container( - padding: const EdgeInsets.all(UIConstants.spacing8), - decoration: BoxDecoration( - color: iconColor.withOpacity(0.1), - borderRadius: BorderRadius.circular(UIConstants.radius8), - ), - child: Icon(icon, color: iconColor, size: UIConstants.iconSizeMedium), - ), - const SizedBox(width: UIConstants.spacing16), - Expanded( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - title, - style: theme.textTheme.titleMedium?.copyWith( - color: colorScheme.onSurface, - fontWeight: FontWeight.w600, - ), - ), - const SizedBox(height: UIConstants.spacing4), - Text( - subtitle, - style: theme.textTheme.bodyMedium?.copyWith( - color: colorScheme.onSurfaceVariant, - ), - ), - ], - ), - ), - Text( - time, - style: theme.textTheme.bodySmall?.copyWith( - color: colorScheme.onSurfaceVariant, - ), - ), - ], - ); - } +@override +void initState() { +super.initState(); +_initializeAnimations(); +_startPageAnimation(); +_loadDashboardData(); } + +void _initializeAnimations() { +// Page Animation Controller +_pageAnimationController = AnimationController( +duration: UIConstants.durationSlow, +vsync: this, +); + +// Cards Animation Controller +_cardsAnimationController = AnimationController( +duration: UIConstants.durationNormal, +vsync: this, +); + +// Actions Animation Controller +_actionsAnimationController = AnimationController( +duration: UIConstants.durationNormal, +vsync: this, +); + +// Page Animations +_pageFadeAnimation = Tween(begin: 0.0, end: 1.0).animate( +CurvedAnimation( +parent: _pageAnimationController, +curve: UIConstants.curveNormal, +), +); + +_pageSlideAnimation = +Tween(begin: const Offset(0, 0.3), end: Offset.zero).animate( +CurvedAnimation( +parent: _pageAnimationController, +curve: UIConstants.curveNormal, +), +); + +// Cards Animations +_cardsScaleAnimation = Tween(begin: 0.8, end: 1.0).animate( +CurvedAnimation( +parent: _cardsAnimationController, +curve: UIConstants.curveElastic, +), +); + +// Actions Animations +_actionsScaleAnimation = Tween(begin: 0.8, end: 1.0).animate( +CurvedAnimation( +parent: _actionsAnimationController, +curve: UIConstants.curveElastic, +), +); +} + +void _startPageAnimation() async { +await Future.delayed(const Duration(milliseconds: 300)); +_pageAnimationController.forward(); + +await Future.delayed(const Duration(milliseconds: 400)); +_cardsAnimationController.forward(); + +await Future.delayed(const Duration(milliseconds: 300)); +_actionsAnimationController.forward(); +} + +Future _loadDashboardData() async { +// TODO: replace with actual API calls, e.g., via a DashboardViewModel +// Simulate network delay +await Future.delayed(const Duration(milliseconds: 400)); + +setState(() { +_dashboardStats = [ +{ +'title': 'Total Users', +'subtitle': 'Active accounts', +'numericValue': 1234, +'valueSuffix': '', +'icon': Icons.people, +'type': DashboardCardType.primary, +'onTap': () {}, +}, +{ +'title': 'System Uptime', +'subtitle': 'All systems operational', +'numericValue': 99.9, +'valueSuffix': '%', +'icon': Icons.check_circle, +'type': DashboardCardType.success, +'onTap': () {}, +}, +{ +'title': 'Security Alerts', +'subtitle': 'Last 24 hours', +'numericValue': 2, +'valueSuffix': '', +'icon': Icons.security, +'type': DashboardCardType.info, +'onTap': () {}, +}, +{ +'title': 'Avg. Response Time', +'subtitle': 'System performance', +'numericValue': 2.3, +'valueSuffix': 's', +'icon': Icons.speed, +'type': DashboardCardType.secondary, +'onTap': () {}, +}, +]; +}); +} + +@override +void dispose() { +_pageAnimationController.dispose(); +_cardsAnimationController.dispose(); +_actionsAnimationController.dispose(); +super.dispose(); +} + +@override +Widget build(BuildContext context) { +final theme = Theme.of(context); +final colorScheme = theme.colorScheme; +final size = MediaQuery.of(context).size; +final userName = UserManager().userName; + +return Scaffold( +backgroundColor: colorScheme.background, +appBar: ModernAppBar( +title: 'Dashboard', +centerTitle: false, +showLogoInTitle: true, +logoImage: _getDashboardLogoImage(colorScheme), +userAvatar: null, +userAvatarImage: _getDashboardLogoImage(colorScheme), +userName: userName, +onProfilePressed: () { +Navigator.pushNamed(context, RouteNames.profileView); +}, +), +drawer: ModernDrawer(items: _drawerItems), +body: Container( +decoration: BoxDecoration( +gradient: LinearGradient( +begin: Alignment.topLeft, +end: Alignment.bottomRight, +colors: [ +colorScheme.background, +colorScheme.surfaceVariant.withOpacity(0.1), +colorScheme.primaryContainer.withOpacity(0.05), +], +), +), +child: SafeArea( +child: SingleChildScrollView( +padding: UIConstants.getResponsivePadding( +context, +mobile: const EdgeInsets.all(UIConstants.spacing24), +tablet: const EdgeInsets.all(UIConstants.spacing32), +desktop: const EdgeInsets.all(UIConstants.spacing40), +), +child: Column( +crossAxisAlignment: CrossAxisAlignment.start, +children: [ +// Welcome Section +_buildWelcomeSection(theme, colorScheme, userName), + +SizedBox( +height: UIConstants.getResponsiveSpacing( +context, +mobile: UIConstants.spacing32, +tablet: UIConstants.spacing40, +desktop: UIConstants.spacing48, +), +), + +// Dashboard Stats +_buildDashboardStats(theme, colorScheme), + +SizedBox( +height: UIConstants.getResponsiveSpacing( +context, +mobile: UIConstants.spacing40, +tablet: UIConstants.spacing56, +desktop: UIConstants.spacing72, +), +), + +// Quick Actions +_buildQuickActions(theme, colorScheme), + +SizedBox( +height: UIConstants.getResponsiveSpacing( +context, +mobile: UIConstants.spacing40, +tablet: UIConstants.spacing56, +desktop: UIConstants.spacing72, +), +), + +// Recent Activity Section +_buildRecentActivity(theme, colorScheme), +], +), +), +), +), +); +} + +ImageProvider? _getDashboardLogoImage(ColorScheme cs) { +// Prefer dynamic logo from system parameters if present +try { +final sysVm = Provider.of(context, listen: true); +if (sysVm.profileImageBytes != null && +sysVm.profileImageBytes!.isNotEmpty) { +return MemoryImage(sysVm.profileImageBytes!); +} +} catch (_) { +// Provider not available – fall through to default asset +} + +// Default asset logo +return const AssetImage('assets/images/image_not_found.png'); +} + +Widget _buildWelcomeSection( +ThemeData theme, +ColorScheme colorScheme, +String? userName, +) { +return AnimatedBuilder( +animation: _pageAnimationController, +builder: (context, child) { +return FadeTransition( +opacity: _pageFadeAnimation, +child: SlideTransition( +position: _pageSlideAnimation, +child: Column( +crossAxisAlignment: CrossAxisAlignment.start, +children: [ +Text( +'Welcome back, ${userName ?? 'User'}! 👋', +style: theme.textTheme.headlineMedium?.copyWith( +color: colorScheme.onBackground, +fontWeight: FontWeight.w700, +), +maxLines: 1, +overflow: TextOverflow.ellipsis, +), +const SizedBox(height: UIConstants.spacing8), +Text( +'Here\'s what\'s happening with your system today', +style: theme.textTheme.bodyLarge?.copyWith( +color: colorScheme.onSurfaceVariant, +), +maxLines: 2, +overflow: TextOverflow.ellipsis, +), +], +), +), +); +}, +); +} + +// Removed in-body logo: AppBar now displays the logo. + +Widget _buildDashboardStats(ThemeData theme, ColorScheme colorScheme) { +return AnimatedBuilder( +animation: _cardsAnimationController, +builder: (context, child) { +return Transform.scale( +scale: _cardsScaleAnimation.value, +child: Column( +crossAxisAlignment: CrossAxisAlignment.start, +children: [ +Text( +'System Overview', +style: theme.textTheme.titleLarge?.copyWith( +color: colorScheme.onBackground, +fontWeight: FontWeight.w600, +), +), +const SizedBox(height: UIConstants.spacing24), + +// Responsive Grid +LayoutBuilder( +builder: (context, constraints) { +final crossAxisCount = UIConstants.isMobile(context) +? 2 +: UIConstants.isTablet(context) +? 3 +: 4; + +// Use fixed mainAxisExtent per breakpoint to avoid overflow +final double mainAxisExtent = UIConstants.isMobile(context) +? 130 +: (UIConstants.isTablet(context) ? 160 : 180); + +return GridView.builder( +shrinkWrap: true, +physics: const NeverScrollableScrollPhysics(), +gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( +crossAxisCount: crossAxisCount, +crossAxisSpacing: UIConstants.spacing16, +mainAxisSpacing: UIConstants.spacing16, +mainAxisExtent: mainAxisExtent, +), +itemCount: _dashboardStats.length, +itemBuilder: (context, index) { +final stat = _dashboardStats[index]; +return DashboardCard( +title: stat['title'], +subtitle: stat['subtitle'], +value: stat['value'], +numericValue: stat['numericValue'], +valueSuffix: stat['valueSuffix'], +animationDuration: UIConstants.durationNormal, +icon: stat['icon'], +type: stat['type'], +onTap: stat['onTap'], +); +}, +); +}, +), +], +), +); +}, +); +} + +Widget _buildQuickActions(ThemeData theme, ColorScheme colorScheme) { +return AnimatedBuilder( +animation: _actionsAnimationController, +builder: (context, child) { +return Transform.scale( +scale: _actionsScaleAnimation.value, +child: Column( +crossAxisAlignment: CrossAxisAlignment.start, +children: [ +Text( +'Quick Actions', +style: theme.textTheme.titleLarge?.copyWith( +color: colorScheme.onBackground, +fontWeight: FontWeight.w600, +), +), +const SizedBox(height: UIConstants.spacing24), + +// Responsive Grid +LayoutBuilder( +builder: (context, constraints) { +final crossAxisCount = UIConstants.isMobile(context) +? 2 +: UIConstants.isTablet(context) +? 4 +: 6; + +return GridView.builder( +shrinkWrap: true, +physics: const NeverScrollableScrollPhysics(), +gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( +crossAxisCount: crossAxisCount, +crossAxisSpacing: UIConstants.spacing16, +mainAxisSpacing: UIConstants.spacing16, +childAspectRatio: 1.0, +), +itemCount: _quickActions.length, +itemBuilder: (context, index) { +final action = _quickActions[index]; +return QuickActionButton( +label: action['label'], +icon: action['icon'], +onTap: action['onTap'], +backgroundColor: action['backgroundColor'], +size: UIConstants.logoSizeMedium, +); +}, +); +}, +), +], +), +); +}, +); +} + +Widget _buildRecentActivity(ThemeData theme, ColorScheme colorScheme) { +return Column( +crossAxisAlignment: CrossAxisAlignment.start, +children: [ +Text( +'Recent Activity', +style: theme.textTheme.titleLarge?.copyWith( +color: colorScheme.onBackground, +fontWeight: FontWeight.w600, +), +), +const SizedBox(height: UIConstants.spacing24), +Container( +padding: UIConstants.cardPaddingMedium, +decoration: BoxDecoration( +color: colorScheme.surface, +borderRadius: BorderRadius.circular(UIConstants.radius16), +boxShadow: [ +BoxShadow( +color: colorScheme.shadow.withOpacity(0.1), +blurRadius: 8, +offset: const Offset(0, 2), +), +], +), +child: Column( +children: [ +_buildActivityItem( +theme, +colorScheme, +Icons.security, +'Security scan completed', +'System security check finished successfully', +'2 minutes ago', +AppColorScheme.success, +), +const Divider(height: UIConstants.spacing24), +_buildActivityItem( +theme, +colorScheme, +Icons.update, +'System updated', +'Latest security patches installed', +'1 hour ago', +AppColorScheme.info, +), +const Divider(height: UIConstants.spacing24), +_buildActivityItem( +theme, +colorScheme, +Icons.backup, +'Backup completed', +'Daily backup process finished', +'3 hours ago', +colorScheme.primary, +), +], +), +), +], +); +} + +Widget _buildActivityItem( +ThemeData theme, +ColorScheme colorScheme, +IconData icon, +String title, +String subtitle, +String time, +Color iconColor, +) { +return Row( +children: [ +Container( +padding: const EdgeInsets.all(UIConstants.spacing8), +decoration: BoxDecoration( +color: iconColor.withOpacity(0.1), +borderRadius: BorderRadius.circular(UIConstants.radius8), +), +child: Icon(icon, color: iconColor, size: UIConstants.iconSizeMedium), +), +const SizedBox(width: UIConstants.spacing16), +Expanded( +child: Column( +crossAxisAlignment: CrossAxisAlignment.start, +children: [ +Text( +title, +style: theme.textTheme.titleMedium?.copyWith( +color: colorScheme.onSurface, +fontWeight: FontWeight.w600, +), +), +const SizedBox(height: UIConstants.spacing4), +Text( +subtitle, +style: theme.textTheme.bodyMedium?.copyWith( +color: colorScheme.onSurfaceVariant, +), +), +], +), +), +Text( +time, +style: theme.textTheme.bodySmall?.copyWith( +color: colorScheme.onSurfaceVariant, +), +), +], +); +} +} \ No newline at end of file diff --git a/testflutterbugdt-test2-b/authsec_springboot/backend/src/main/java/com/realnet/Builders/Services/BuilderService.java b/testflutterbugdt-test2-b/authsec_springboot/backend/src/main/java/com/realnet/Builders/Services/BuilderService.java index f9801fb..9f848cd 100644 --- a/testflutterbugdt-test2-b/authsec_springboot/backend/src/main/java/com/realnet/Builders/Services/BuilderService.java +++ b/testflutterbugdt-test2-b/authsec_springboot/backend/src/main/java/com/realnet/Builders/Services/BuilderService.java @@ -69,6 +69,15 @@ public class BuilderService { executeDump(true); // ADD OTHER SERVICE +addCustomMenu( "Testlist","Testlist", "Transcations"); + + +addCustomMenu( "Child","Child", "Transcations"); + + +addCustomMenu( "Testbug","Testbug", "Transcations"); + + System.out.println("dashboard and menu inserted..."); diff --git a/testflutterbugdt-test2-b/authsec_springboot/backend/src/main/java/com/realnet/basic1/Controllers/ChildController.java b/testflutterbugdt-test2-b/authsec_springboot/backend/src/main/java/com/realnet/basic1/Controllers/ChildController.java new file mode 100644 index 0000000..06c224c --- /dev/null +++ b/testflutterbugdt-test2-b/authsec_springboot/backend/src/main/java/com/realnet/basic1/Controllers/ChildController.java @@ -0,0 +1,83 @@ +package com.realnet.basic1.Controllers; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; + import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; +import com.fasterxml.jackson.core.JsonProcessingException; +import org.springframework.web.bind.annotation.CrossOrigin; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.realnet.config.EmailService; +import com.realnet.users.entity1.AppUser; +import com.realnet.users.service1.AppUserServiceImpl; +import com.fasterxml.jackson.databind.ObjectMapper; +import org.springframework.data.domain.*; +import com.realnet.fnd.response.EntityResponse; +import org.springframework.http.*; +import org.springframework.beans.factory.annotation.*; +import com.realnet.basic1.Entity.Child; +import com.realnet.basic1.Services.ChildService ; + + +@RequestMapping(value = "/Child") + @CrossOrigin("*") +@RestController +public class ChildController { + @Autowired + private ChildService Service; + +@Value("${projectPath}") + private String projectPath; + + + + @PostMapping("/Child") + public Child Savedata(@RequestBody Child data) { + Child save = Service.Savedata(data) ; + + System.out.println("data saved..." + save); + + return save; + } +@PutMapping("/Child/{id}") + public Child update(@RequestBody Child data,@PathVariable Integer id ) { + Child update = Service.update(data,id); + System.out.println("data update..." + update); + return update; + } +// get all with pagination + @GetMapping("/Child/getall/page") + public Page getall(@RequestParam(value = "page", required = false) Integer page, + @RequestParam(value = "size", required = false) Integer size) { + Pageable paging = PageRequest.of(page, size); + Page get = Service.getAllWithPagination(paging); + + return get; + + } + @GetMapping("/Child") + public List getdetails() { + List get = Service.getdetails(); + return get; +} +// get all without authentication + + @GetMapping("/token/Child") + public List getallwioutsec() { + List get = Service.getdetails(); + return get; +} +@GetMapping("/Child/{id}") + public Child getdetailsbyId(@PathVariable Integer id ) { + Child get = Service.getdetailsbyId(id); + return get; + } +@DeleteMapping("/Child/{id}") + public ResponseEntity delete_by_id(@PathVariable Integer id ) { + Service.delete_by_id(id); + return new ResponseEntity<>(new EntityResponse("Deleted"), HttpStatus.OK); + + } + + + +} \ No newline at end of file diff --git a/testflutterbugdt-test2-b/authsec_springboot/backend/src/main/java/com/realnet/basic1/Controllers/TestbugController.java b/testflutterbugdt-test2-b/authsec_springboot/backend/src/main/java/com/realnet/basic1/Controllers/TestbugController.java new file mode 100644 index 0000000..4a57f70 --- /dev/null +++ b/testflutterbugdt-test2-b/authsec_springboot/backend/src/main/java/com/realnet/basic1/Controllers/TestbugController.java @@ -0,0 +1,155 @@ +package com.realnet.basic1.Controllers; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; + import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; +import com.fasterxml.jackson.core.JsonProcessingException; +import org.springframework.web.bind.annotation.CrossOrigin; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.realnet.config.EmailService; +import com.realnet.users.entity1.AppUser; +import com.realnet.users.service1.AppUserServiceImpl; +import com.fasterxml.jackson.databind.ObjectMapper; +import org.springframework.data.domain.*; +import com.realnet.fnd.response.EntityResponse; +import org.springframework.http.*; +import org.springframework.beans.factory.annotation.*; +import com.realnet.basic1.Entity.Testbug; +import com.realnet.basic1.Services.TestbugService ; + + + + + + + + + + + + + + + + + + + + +@RequestMapping(value = "/Testbug") + @CrossOrigin("*") +@RestController +public class TestbugController { + @Autowired + private TestbugService Service; + +@Value("${projectPath}") + private String projectPath; + + + + + + + + + + + + + + + + + + + + + + @PostMapping("/Testbug") + public Testbug Savedata(@RequestBody Testbug data) { + Testbug save = Service.Savedata(data) ; + + + + + + + + + + + + + + + + + + + + System.out.println("data saved..." + save); + + return save; + } +@PutMapping("/Testbug/{id}") + public Testbug update(@RequestBody Testbug data,@PathVariable Integer id ) { + Testbug update = Service.update(data,id); + System.out.println("data update..." + update); + return update; + } +// get all with pagination + @GetMapping("/Testbug/getall/page") + public Page getall(@RequestParam(value = "page", required = false) Integer page, + @RequestParam(value = "size", required = false) Integer size) { + Pageable paging = PageRequest.of(page, size); + Page get = Service.getAllWithPagination(paging); + + return get; + + } + @GetMapping("/Testbug") + public List getdetails() { + List get = Service.getdetails(); + return get; +} +// get all without authentication + + @GetMapping("/token/Testbug") + public List getallwioutsec() { + List get = Service.getdetails(); + return get; +} +@GetMapping("/Testbug/{id}") + public Testbug getdetailsbyId(@PathVariable Integer id ) { + Testbug get = Service.getdetailsbyId(id); + return get; + } +@DeleteMapping("/Testbug/{id}") + public ResponseEntity delete_by_id(@PathVariable Integer id ) { + Service.delete_by_id(id); + return new ResponseEntity<>(new EntityResponse("Deleted"), HttpStatus.OK); + + } + + + + + + + + + + + + + + + + + + + + + +} \ No newline at end of file diff --git a/testflutterbugdt-test2-b/authsec_springboot/backend/src/main/java/com/realnet/basic1/Controllers/TestlistController.java b/testflutterbugdt-test2-b/authsec_springboot/backend/src/main/java/com/realnet/basic1/Controllers/TestlistController.java new file mode 100644 index 0000000..c78281b --- /dev/null +++ b/testflutterbugdt-test2-b/authsec_springboot/backend/src/main/java/com/realnet/basic1/Controllers/TestlistController.java @@ -0,0 +1,99 @@ +package com.realnet.basic1.Controllers; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; + import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; +import com.fasterxml.jackson.core.JsonProcessingException; +import org.springframework.web.bind.annotation.CrossOrigin; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.realnet.config.EmailService; +import com.realnet.users.entity1.AppUser; +import com.realnet.users.service1.AppUserServiceImpl; +import com.fasterxml.jackson.databind.ObjectMapper; +import org.springframework.data.domain.*; +import com.realnet.fnd.response.EntityResponse; +import org.springframework.http.*; +import org.springframework.beans.factory.annotation.*; +import com.realnet.basic1.Entity.Testlist; +import com.realnet.basic1.Services.TestlistService ; + + + + + + +@RequestMapping(value = "/Testlist") + @CrossOrigin("*") +@RestController +public class TestlistController { + @Autowired + private TestlistService Service; + +@Value("${projectPath}") + private String projectPath; + + + + + + + + @PostMapping("/Testlist") + public Testlist Savedata(@RequestBody Testlist data) { + Testlist save = Service.Savedata(data) ; + + + + + + System.out.println("data saved..." + save); + + return save; + } +@PutMapping("/Testlist/{id}") + public Testlist update(@RequestBody Testlist data,@PathVariable Integer id ) { + Testlist update = Service.update(data,id); + System.out.println("data update..." + update); + return update; + } +// get all with pagination + @GetMapping("/Testlist/getall/page") + public Page getall(@RequestParam(value = "page", required = false) Integer page, + @RequestParam(value = "size", required = false) Integer size) { + Pageable paging = PageRequest.of(page, size); + Page get = Service.getAllWithPagination(paging); + + return get; + + } + @GetMapping("/Testlist") + public List getdetails() { + List get = Service.getdetails(); + return get; +} +// get all without authentication + + @GetMapping("/token/Testlist") + public List getallwioutsec() { + List get = Service.getdetails(); + return get; +} +@GetMapping("/Testlist/{id}") + public Testlist getdetailsbyId(@PathVariable Integer id ) { + Testlist get = Service.getdetailsbyId(id); + return get; + } +@DeleteMapping("/Testlist/{id}") + public ResponseEntity delete_by_id(@PathVariable Integer id ) { + Service.delete_by_id(id); + return new ResponseEntity<>(new EntityResponse("Deleted"), HttpStatus.OK); + + } + + + + + + + +} \ No newline at end of file diff --git a/testflutterbugdt-test2-b/authsec_springboot/backend/src/main/java/com/realnet/basic1/Controllers/Testlist_ListFilter1Controller.java b/testflutterbugdt-test2-b/authsec_springboot/backend/src/main/java/com/realnet/basic1/Controllers/Testlist_ListFilter1Controller.java new file mode 100644 index 0000000..646a563 --- /dev/null +++ b/testflutterbugdt-test2-b/authsec_springboot/backend/src/main/java/com/realnet/basic1/Controllers/Testlist_ListFilter1Controller.java @@ -0,0 +1,24 @@ +package com.realnet.basic1.Controllers; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; + import org.springframework.web.bind.annotation.*; +import com.realnet.basic1.Entity.Testlist_ListFilter1; +import com.realnet.basic1.Services.Testlist_ListFilter1Service ; +@RequestMapping(value = "/Testlist_ListFilter1") +@RestController +public class Testlist_ListFilter1Controller { + + @Autowired + private Testlist_ListFilter1Service Service; + + @GetMapping("/Testlist_ListFilter1") + public List getlist() { + List get = Service.getlistbuilder(); + return get; +} + @GetMapping("/Testlist_ListFilter11") + public List getlistwithparam( ) { + List get = Service.getlistbuilderparam( ); + return get; +} +} \ No newline at end of file diff --git a/testflutterbugdt-test2-b/authsec_springboot/backend/src/main/java/com/realnet/basic1/Controllers/tokenFree_ChildController.java b/testflutterbugdt-test2-b/authsec_springboot/backend/src/main/java/com/realnet/basic1/Controllers/tokenFree_ChildController.java new file mode 100644 index 0000000..7f4c76c --- /dev/null +++ b/testflutterbugdt-test2-b/authsec_springboot/backend/src/main/java/com/realnet/basic1/Controllers/tokenFree_ChildController.java @@ -0,0 +1,83 @@ +package com.realnet.basic1.Controllers; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; + import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; +import com.fasterxml.jackson.core.JsonProcessingException; +import org.springframework.web.bind.annotation.CrossOrigin; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.realnet.config.EmailService; +import com.realnet.users.entity1.AppUser; +import com.realnet.users.service1.AppUserServiceImpl; +import com.fasterxml.jackson.databind.ObjectMapper; +import org.springframework.data.domain.*; +import com.realnet.fnd.response.EntityResponse; +import org.springframework.http.*; +import org.springframework.beans.factory.annotation.*; +import com.realnet.basic1.Entity.Child; +import com.realnet.basic1.Services.ChildService ; + + +@RequestMapping(value = "/token/Child") + @CrossOrigin("*") +@RestController +public class tokenFree_ChildController { + @Autowired + private ChildService Service; + +@Value("${projectPath}") + private String projectPath; + + + + @PostMapping("/Child") + public Child Savedata(@RequestBody Child data) { + Child save = Service.Savedata(data) ; + + System.out.println("data saved..." + save); + + return save; + } +@PutMapping("/Child/{id}") + public Child update(@RequestBody Child data,@PathVariable Integer id ) { + Child update = Service.update(data,id); + System.out.println("data update..." + update); + return update; + } +// get all with pagination + @GetMapping("/Child/getall/page") + public Page getall(@RequestParam(value = "page", required = false) Integer page, + @RequestParam(value = "size", required = false) Integer size) { + Pageable paging = PageRequest.of(page, size); + Page get = Service.getAllWithPagination(paging); + + return get; + + } + @GetMapping("/Child") + public List getdetails() { + List get = Service.getdetails(); + return get; +} +// get all without authentication + + @GetMapping("/token/Child") + public List getallwioutsec() { + List get = Service.getdetails(); + return get; +} +@GetMapping("/Child/{id}") + public Child getdetailsbyId(@PathVariable Integer id ) { + Child get = Service.getdetailsbyId(id); + return get; + } +@DeleteMapping("/Child/{id}") + public ResponseEntity delete_by_id(@PathVariable Integer id ) { + Service.delete_by_id(id); + return new ResponseEntity<>(new EntityResponse("Deleted"), HttpStatus.OK); + + } + + + +} \ No newline at end of file diff --git a/testflutterbugdt-test2-b/authsec_springboot/backend/src/main/java/com/realnet/basic1/Controllers/tokenFree_TestbugController.java b/testflutterbugdt-test2-b/authsec_springboot/backend/src/main/java/com/realnet/basic1/Controllers/tokenFree_TestbugController.java new file mode 100644 index 0000000..253a82e --- /dev/null +++ b/testflutterbugdt-test2-b/authsec_springboot/backend/src/main/java/com/realnet/basic1/Controllers/tokenFree_TestbugController.java @@ -0,0 +1,155 @@ +package com.realnet.basic1.Controllers; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; + import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; +import com.fasterxml.jackson.core.JsonProcessingException; +import org.springframework.web.bind.annotation.CrossOrigin; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.realnet.config.EmailService; +import com.realnet.users.entity1.AppUser; +import com.realnet.users.service1.AppUserServiceImpl; +import com.fasterxml.jackson.databind.ObjectMapper; +import org.springframework.data.domain.*; +import com.realnet.fnd.response.EntityResponse; +import org.springframework.http.*; +import org.springframework.beans.factory.annotation.*; +import com.realnet.basic1.Entity.Testbug; +import com.realnet.basic1.Services.TestbugService ; + + + + + + + + + + + + + + + + + + + + +@RequestMapping(value = "/token/Testbug") + @CrossOrigin("*") +@RestController +public class tokenFree_TestbugController { + @Autowired + private TestbugService Service; + +@Value("${projectPath}") + private String projectPath; + + + + + + + + + + + + + + + + + + + + + + @PostMapping("/Testbug") + public Testbug Savedata(@RequestBody Testbug data) { + Testbug save = Service.Savedata(data) ; + + + + + + + + + + + + + + + + + + + + System.out.println("data saved..." + save); + + return save; + } +@PutMapping("/Testbug/{id}") + public Testbug update(@RequestBody Testbug data,@PathVariable Integer id ) { + Testbug update = Service.update(data,id); + System.out.println("data update..." + update); + return update; + } +// get all with pagination + @GetMapping("/Testbug/getall/page") + public Page getall(@RequestParam(value = "page", required = false) Integer page, + @RequestParam(value = "size", required = false) Integer size) { + Pageable paging = PageRequest.of(page, size); + Page get = Service.getAllWithPagination(paging); + + return get; + + } + @GetMapping("/Testbug") + public List getdetails() { + List get = Service.getdetails(); + return get; +} +// get all without authentication + + @GetMapping("/token/Testbug") + public List getallwioutsec() { + List get = Service.getdetails(); + return get; +} +@GetMapping("/Testbug/{id}") + public Testbug getdetailsbyId(@PathVariable Integer id ) { + Testbug get = Service.getdetailsbyId(id); + return get; + } +@DeleteMapping("/Testbug/{id}") + public ResponseEntity delete_by_id(@PathVariable Integer id ) { + Service.delete_by_id(id); + return new ResponseEntity<>(new EntityResponse("Deleted"), HttpStatus.OK); + + } + + + + + + + + + + + + + + + + + + + + + +} \ No newline at end of file diff --git a/testflutterbugdt-test2-b/authsec_springboot/backend/src/main/java/com/realnet/basic1/Controllers/tokenFree_TestlistController.java b/testflutterbugdt-test2-b/authsec_springboot/backend/src/main/java/com/realnet/basic1/Controllers/tokenFree_TestlistController.java new file mode 100644 index 0000000..ad8a76e --- /dev/null +++ b/testflutterbugdt-test2-b/authsec_springboot/backend/src/main/java/com/realnet/basic1/Controllers/tokenFree_TestlistController.java @@ -0,0 +1,99 @@ +package com.realnet.basic1.Controllers; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; + import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; +import com.fasterxml.jackson.core.JsonProcessingException; +import org.springframework.web.bind.annotation.CrossOrigin; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.realnet.config.EmailService; +import com.realnet.users.entity1.AppUser; +import com.realnet.users.service1.AppUserServiceImpl; +import com.fasterxml.jackson.databind.ObjectMapper; +import org.springframework.data.domain.*; +import com.realnet.fnd.response.EntityResponse; +import org.springframework.http.*; +import org.springframework.beans.factory.annotation.*; +import com.realnet.basic1.Entity.Testlist; +import com.realnet.basic1.Services.TestlistService ; + + + + + + +@RequestMapping(value = "/token/Testlist") + @CrossOrigin("*") +@RestController +public class tokenFree_TestlistController { + @Autowired + private TestlistService Service; + +@Value("${projectPath}") + private String projectPath; + + + + + + + + @PostMapping("/Testlist") + public Testlist Savedata(@RequestBody Testlist data) { + Testlist save = Service.Savedata(data) ; + + + + + + System.out.println("data saved..." + save); + + return save; + } +@PutMapping("/Testlist/{id}") + public Testlist update(@RequestBody Testlist data,@PathVariable Integer id ) { + Testlist update = Service.update(data,id); + System.out.println("data update..." + update); + return update; + } +// get all with pagination + @GetMapping("/Testlist/getall/page") + public Page getall(@RequestParam(value = "page", required = false) Integer page, + @RequestParam(value = "size", required = false) Integer size) { + Pageable paging = PageRequest.of(page, size); + Page get = Service.getAllWithPagination(paging); + + return get; + + } + @GetMapping("/Testlist") + public List getdetails() { + List get = Service.getdetails(); + return get; +} +// get all without authentication + + @GetMapping("/token/Testlist") + public List getallwioutsec() { + List get = Service.getdetails(); + return get; +} +@GetMapping("/Testlist/{id}") + public Testlist getdetailsbyId(@PathVariable Integer id ) { + Testlist get = Service.getdetailsbyId(id); + return get; + } +@DeleteMapping("/Testlist/{id}") + public ResponseEntity delete_by_id(@PathVariable Integer id ) { + Service.delete_by_id(id); + return new ResponseEntity<>(new EntityResponse("Deleted"), HttpStatus.OK); + + } + + + + + + + +} \ No newline at end of file diff --git a/testflutterbugdt-test2-b/authsec_springboot/backend/src/main/java/com/realnet/basic1/Controllers/tokenFree_Testlist_ListFilter1Controller.java b/testflutterbugdt-test2-b/authsec_springboot/backend/src/main/java/com/realnet/basic1/Controllers/tokenFree_Testlist_ListFilter1Controller.java new file mode 100644 index 0000000..32f1981 --- /dev/null +++ b/testflutterbugdt-test2-b/authsec_springboot/backend/src/main/java/com/realnet/basic1/Controllers/tokenFree_Testlist_ListFilter1Controller.java @@ -0,0 +1,24 @@ +package com.realnet.basic1.Controllers; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; + import org.springframework.web.bind.annotation.*; +import com.realnet.basic1.Entity.Testlist_ListFilter1; +import com.realnet.basic1.Services.Testlist_ListFilter1Service ; +@RequestMapping(value = "/token/Testlist_ListFilter1") +@RestController +public class tokenFree_Testlist_ListFilter1Controller { + + @Autowired + private Testlist_ListFilter1Service Service; + + @GetMapping("/Testlist_ListFilter1") + public List getlist() { + List get = Service.getlistbuilder(); + return get; +} + @GetMapping("/Testlist_ListFilter11") + public List getlistwithparam( ) { + List get = Service.getlistbuilderparam( ); + return get; +} +} \ No newline at end of file diff --git a/testflutterbugdt-test2-b/authsec_springboot/backend/src/main/java/com/realnet/basic1/Entity/Child.java b/testflutterbugdt-test2-b/authsec_springboot/backend/src/main/java/com/realnet/basic1/Entity/Child.java new file mode 100644 index 0000000..5fbe311 --- /dev/null +++ b/testflutterbugdt-test2-b/authsec_springboot/backend/src/main/java/com/realnet/basic1/Entity/Child.java @@ -0,0 +1,24 @@ +package com.realnet.basic1.Entity; + import lombok.*; +import com.realnet.WhoColumn.Entity.Extension; + import javax.persistence.*; + import java.time.LocalDateTime; + import java.util.*; + + + @Entity + @Data + public class Child extends Extension { + /** + * + */ + private static final long serialVersionUID = 1L; + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private Integer id; + +private String namek; + + +} diff --git a/testflutterbugdt-test2-b/authsec_springboot/backend/src/main/java/com/realnet/basic1/Entity/Testbug.java b/testflutterbugdt-test2-b/authsec_springboot/backend/src/main/java/com/realnet/basic1/Entity/Testbug.java new file mode 100644 index 0000000..0bf82b0 --- /dev/null +++ b/testflutterbugdt-test2-b/authsec_springboot/backend/src/main/java/com/realnet/basic1/Entity/Testbug.java @@ -0,0 +1,75 @@ +package com.realnet.basic1.Entity; + import lombok.*; +import com.realnet.WhoColumn.Entity.Extension; + import javax.persistence.*; + import java.time.LocalDateTime; + import java.util.*; + + + + + + +import com.realnet.basic1.Entity.Child; + + + + + + + + + + + + + + @Entity + @Data + public class Testbug extends Extension { + /** + * + */ + private static final long serialVersionUID = 1L; + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private Integer id; + +private String name; + +private String fileupload_fieldsname; +private String fileupload_fieldspath ; + + + + + +private String bar_code; + + + + +private String qr_code; + + + +@OneToOne( cascade=CascadeType.ALL) + private Child child; + + + + + +private String select_dyanamic; +private String select_dyanamicidentifier; + +private String select_dynamic_mul; + +private String select_autocomp; +private String select_autocompidentifier; + +private String select_autcomp_mul; + + +} diff --git a/testflutterbugdt-test2-b/authsec_springboot/backend/src/main/java/com/realnet/basic1/Entity/Testlist.java b/testflutterbugdt-test2-b/authsec_springboot/backend/src/main/java/com/realnet/basic1/Entity/Testlist.java new file mode 100644 index 0000000..503e0a2 --- /dev/null +++ b/testflutterbugdt-test2-b/authsec_springboot/backend/src/main/java/com/realnet/basic1/Entity/Testlist.java @@ -0,0 +1,33 @@ +package com.realnet.basic1.Entity; + import lombok.*; +import com.realnet.WhoColumn.Entity.Extension; + import javax.persistence.*; + import java.time.LocalDateTime; + import java.util.*; + + + + + + + @Entity + @Data + public class Testlist extends Extension { + /** + * + */ + private static final long serialVersionUID = 1L; + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private Integer id; + +private String name; + +@Column(length = 2000) +private String description; + +private Boolean active; + + +} diff --git a/testflutterbugdt-test2-b/authsec_springboot/backend/src/main/java/com/realnet/basic1/Entity/Testlist_ListFilter1.java b/testflutterbugdt-test2-b/authsec_springboot/backend/src/main/java/com/realnet/basic1/Entity/Testlist_ListFilter1.java new file mode 100644 index 0000000..c6ada15 --- /dev/null +++ b/testflutterbugdt-test2-b/authsec_springboot/backend/src/main/java/com/realnet/basic1/Entity/Testlist_ListFilter1.java @@ -0,0 +1,14 @@ +package com.realnet.basic1.Entity; + import lombok.*; + import javax.persistence.*; + import java.time.LocalDateTime; + import java.util.*; + + @Data + public class Testlist_ListFilter1 { + + private Integer id; + + + private String name; +} diff --git a/testflutterbugdt-test2-b/authsec_springboot/backend/src/main/java/com/realnet/basic1/Repository/ChildRepository.java b/testflutterbugdt-test2-b/authsec_springboot/backend/src/main/java/com/realnet/basic1/Repository/ChildRepository.java new file mode 100644 index 0000000..8764687 --- /dev/null +++ b/testflutterbugdt-test2-b/authsec_springboot/backend/src/main/java/com/realnet/basic1/Repository/ChildRepository.java @@ -0,0 +1,26 @@ +package com.realnet.basic1.Repository; + + +import org.springframework.data.domain.Page; +import org.springframework.data.domain.Pageable; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.Query; + +import org.springframework.stereotype.Repository; +import java.util.*; + + + + + +import com.realnet.basic1.Entity.Child; + +@Repository +public interface ChildRepository extends JpaRepository { + +@Query(value = "select * from child where created_by=?1", nativeQuery = true) + List findAll(Long creayedBy); + +@Query(value = "select * from child where created_by=?1", nativeQuery = true) + Page findAll( Long creayedBy,Pageable page); +} \ No newline at end of file diff --git a/testflutterbugdt-test2-b/authsec_springboot/backend/src/main/java/com/realnet/basic1/Repository/TestbugRepository.java b/testflutterbugdt-test2-b/authsec_springboot/backend/src/main/java/com/realnet/basic1/Repository/TestbugRepository.java new file mode 100644 index 0000000..703ed47 --- /dev/null +++ b/testflutterbugdt-test2-b/authsec_springboot/backend/src/main/java/com/realnet/basic1/Repository/TestbugRepository.java @@ -0,0 +1,44 @@ +package com.realnet.basic1.Repository; + + +import org.springframework.data.domain.Page; +import org.springframework.data.domain.Pageable; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.Query; + +import org.springframework.stereotype.Repository; +import java.util.*; + + + + + + + + + + + + + + + + + + + + + + + +import com.realnet.basic1.Entity.Testbug; + +@Repository +public interface TestbugRepository extends JpaRepository { + +@Query(value = "select * from testbug where created_by=?1", nativeQuery = true) + List findAll(Long creayedBy); + +@Query(value = "select * from testbug where created_by=?1", nativeQuery = true) + Page findAll( Long creayedBy,Pageable page); +} \ No newline at end of file diff --git a/testflutterbugdt-test2-b/authsec_springboot/backend/src/main/java/com/realnet/basic1/Repository/TestlistRepository.java b/testflutterbugdt-test2-b/authsec_springboot/backend/src/main/java/com/realnet/basic1/Repository/TestlistRepository.java new file mode 100644 index 0000000..94ab95c --- /dev/null +++ b/testflutterbugdt-test2-b/authsec_springboot/backend/src/main/java/com/realnet/basic1/Repository/TestlistRepository.java @@ -0,0 +1,30 @@ +package com.realnet.basic1.Repository; + + +import org.springframework.data.domain.Page; +import org.springframework.data.domain.Pageable; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.Query; + +import org.springframework.stereotype.Repository; +import java.util.*; + + + + + + + + + +import com.realnet.basic1.Entity.Testlist; + +@Repository +public interface TestlistRepository extends JpaRepository { + +@Query(value = "select * from testlist where created_by=?1", nativeQuery = true) + List findAll(Long creayedBy); + +@Query(value = "select * from testlist where created_by=?1", nativeQuery = true) + Page findAll( Long creayedBy,Pageable page); +} \ No newline at end of file diff --git a/testflutterbugdt-test2-b/authsec_springboot/backend/src/main/java/com/realnet/basic1/Services/ChildService.java b/testflutterbugdt-test2-b/authsec_springboot/backend/src/main/java/com/realnet/basic1/Services/ChildService.java new file mode 100644 index 0000000..fdddb43 --- /dev/null +++ b/testflutterbugdt-test2-b/authsec_springboot/backend/src/main/java/com/realnet/basic1/Services/ChildService.java @@ -0,0 +1,73 @@ +package com.realnet.basic1.Services; +import com.realnet.basic1.Repository.ChildRepository; +import com.realnet.basic1.Entity.Child +;import java.util.*; + +import org.springframework.beans.factory.annotation.Autowired; +import com.realnet.SequenceGenerator.Service.SequenceService; +import org.springframework.data.domain.Page; +import com.realnet.realm.Entity.Realm; +import com.realnet.realm.Services.RealmService; +import org.springframework.data.domain.Pageable; +import org.springframework.http.*; +import com.realnet.users.service1.AppUserServiceImpl; +import com.realnet.users.entity1.AppUser; + + + import org.springframework.stereotype.Service; + +@Service + public class ChildService { +@Autowired +private ChildRepository Repository; + @Autowired + private AppUserServiceImpl userService; +@Autowired + private RealmService realmService; + +public Child Savedata(Child data) { + + + data.setUpdatedBy(getUser().getUserId()); + data.setCreatedBy(getUser().getUserId()); + data.setAccountId(getUser().getAccount().getAccount_id()); +Child save = Repository.save(data); + return save; + } + + +// get all with pagination + public Page getAllWithPagination(Pageable page) { + return Repository.findAll( getUser().getUserId(),page); + } +public List getdetails() { + List realm = realmService.findByUserId(getUser().getUserId()); +List all = Repository.findAll(getUser().getUserId()); + + return all ; } + + +public Child getdetailsbyId(Integer id) { + return Repository.findById(id).get(); + } + + + public void delete_by_id(Integer id) { + Repository.deleteById(id); +} + + +public Child update(Child data,Integer id) { + Child old = Repository.findById(id).get(); +old.setNamek(data.getNamek()); + +final Child test = Repository.save(old); + data.setUpdatedBy(getUser().getUserId()); + return test;} + + + public AppUser getUser() { + AppUser user = userService.getLoggedInUser(); + return user; + + }} diff --git a/testflutterbugdt-test2-b/authsec_springboot/backend/src/main/java/com/realnet/basic1/Services/TestbugService.java b/testflutterbugdt-test2-b/authsec_springboot/backend/src/main/java/com/realnet/basic1/Services/TestbugService.java new file mode 100644 index 0000000..3837ade --- /dev/null +++ b/testflutterbugdt-test2-b/authsec_springboot/backend/src/main/java/com/realnet/basic1/Services/TestbugService.java @@ -0,0 +1,219 @@ +package com.realnet.basic1.Services; +import com.realnet.basic1.Repository.TestbugRepository; +import com.realnet.basic1.Entity.Testbug +;import java.util.*; + +import org.springframework.beans.factory.annotation.Autowired; +import com.realnet.SequenceGenerator.Service.SequenceService; +import org.springframework.data.domain.Page; +import com.realnet.realm.Entity.Realm; +import com.realnet.realm.Services.RealmService; +import org.springframework.data.domain.Pageable; +import org.springframework.http.*; +import com.realnet.users.service1.AppUserServiceImpl; +import com.realnet.users.entity1.AppUser; + + + + + + + + + + + + +import com.realnet.basic1.Entity.Testlist; +import com.realnet.basic1.Services.TestlistService; + + + + + +import com.realnet.basic1.Entity.Testlist; +import com.realnet.basic1.Services.TestlistService; + + + + + + import org.springframework.stereotype.Service; + +@Service + public class TestbugService { +@Autowired +private TestbugRepository Repository; + @Autowired + private AppUserServiceImpl userService; +@Autowired + private RealmService realmService; + + + + + + + + + + + +@Autowired + private TestlistService select_dyanamicserv; + + + +@Autowired + private TestlistService select_autocompserv; + + + +public Testbug Savedata(Testbug data) { + + + + + + + + + + + + + + +if (data.getSelect_dyanamic() != null) { + try { + int select_dyanamicId = Integer.valueOf(data.getSelect_dyanamic()); +Testlist get = select_dyanamicserv.getdetailsbyId(select_dyanamicId); + if (get != null) { + + data.setSelect_dyanamicidentifier(get.getName()); +} +} catch (NumberFormatException e) { + System.out.println(" select_dyanamicId is not integer.."); + // Invalid integer string — ignore or log +data.setSelect_dyanamicidentifier(data.getSelect_dyanamic()); + } + + } + + + + + + + + +if (data.getSelect_autocomp() != null) { + try { + int select_autocompId = Integer.valueOf(data.getSelect_autocomp()); +Testlist get = select_autocompserv.getdetailsbyId(select_autocompId); + if (get != null) { + + data.setSelect_autocompidentifier(get.getName()); +} +} catch (NumberFormatException e) { + System.out.println(" select_autocompId is not integer.."); + // Invalid integer string — ignore or log +data.setSelect_autocompidentifier(data.getSelect_autocomp()); + + } + + } + + + + + + + data.setUpdatedBy(getUser().getUserId()); + data.setCreatedBy(getUser().getUserId()); + data.setAccountId(getUser().getAccount().getAccount_id()); +Testbug save = Repository.save(data); + return save; + } + + +// get all with pagination + public Page getAllWithPagination(Pageable page) { + return Repository.findAll( getUser().getUserId(),page); + } +public List getdetails() { + List realm = realmService.findByUserId(getUser().getUserId()); +List all = Repository.findAll(getUser().getUserId()); + + return all ; } + + +public Testbug getdetailsbyId(Integer id) { + return Repository.findById(id).get(); + } + + + public void delete_by_id(Integer id) { + Repository.deleteById(id); +} + + +public Testbug update(Testbug data,Integer id) { + Testbug old = Repository.findById(id).get(); +old.setName(data.getName()); + + + + + +old.setBar_code(data.getBar_code()); + + + +old.setQr_code(data.getQr_code()); + + + + +old.setChild(data.getChild()); + + + + + +old.setSelect_dyanamic(data.getSelect_dyanamic()); + +old.setSelect_dynamic_mul(data.getSelect_dynamic_mul()); + +old.setSelect_autocomp(data.getSelect_autocomp()); + +old.setSelect_autcomp_mul(data.getSelect_autcomp_mul()); + +final Testbug test = Repository.save(old); + data.setUpdatedBy(getUser().getUserId()); + return test;} + + + + + + + + + + + + + + + + + + + + + public AppUser getUser() { + AppUser user = userService.getLoggedInUser(); + return user; + + }} diff --git a/testflutterbugdt-test2-b/authsec_springboot/backend/src/main/java/com/realnet/basic1/Services/TestlistService.java b/testflutterbugdt-test2-b/authsec_springboot/backend/src/main/java/com/realnet/basic1/Services/TestlistService.java new file mode 100644 index 0000000..756eb5b --- /dev/null +++ b/testflutterbugdt-test2-b/authsec_springboot/backend/src/main/java/com/realnet/basic1/Services/TestlistService.java @@ -0,0 +1,93 @@ +package com.realnet.basic1.Services; +import com.realnet.basic1.Repository.TestlistRepository; +import com.realnet.basic1.Entity.Testlist +;import java.util.*; + +import org.springframework.beans.factory.annotation.Autowired; +import com.realnet.SequenceGenerator.Service.SequenceService; +import org.springframework.data.domain.Page; +import com.realnet.realm.Entity.Realm; +import com.realnet.realm.Services.RealmService; +import org.springframework.data.domain.Pageable; +import org.springframework.http.*; +import com.realnet.users.service1.AppUserServiceImpl; +import com.realnet.users.entity1.AppUser; + + + + + + + import org.springframework.stereotype.Service; + +@Service + public class TestlistService { +@Autowired +private TestlistRepository Repository; + @Autowired + private AppUserServiceImpl userService; +@Autowired + private RealmService realmService; + + + + + +public Testlist Savedata(Testlist data) { + + + + + + + data.setUpdatedBy(getUser().getUserId()); + data.setCreatedBy(getUser().getUserId()); + data.setAccountId(getUser().getAccount().getAccount_id()); +Testlist save = Repository.save(data); + return save; + } + + +// get all with pagination + public Page getAllWithPagination(Pageable page) { + return Repository.findAll( getUser().getUserId(),page); + } +public List getdetails() { + List realm = realmService.findByUserId(getUser().getUserId()); +List all = Repository.findAll(getUser().getUserId()); + + return all ; } + + +public Testlist getdetailsbyId(Integer id) { + return Repository.findById(id).get(); + } + + + public void delete_by_id(Integer id) { + Repository.deleteById(id); +} + + +public Testlist update(Testlist data,Integer id) { + Testlist old = Repository.findById(id).get(); +old.setName(data.getName()); + +old.setDescription(data.getDescription()); + +old.setActive (data.getActive()); + +final Testlist test = Repository.save(old); + data.setUpdatedBy(getUser().getUserId()); + return test;} + + + + + + + public AppUser getUser() { + AppUser user = userService.getLoggedInUser(); + return user; + + }} diff --git a/testflutterbugdt-test2-b/authsec_springboot/backend/src/main/java/com/realnet/basic1/Services/Testlist_ListFilter1Service.java b/testflutterbugdt-test2-b/authsec_springboot/backend/src/main/java/com/realnet/basic1/Services/Testlist_ListFilter1Service.java new file mode 100644 index 0000000..1967243 --- /dev/null +++ b/testflutterbugdt-test2-b/authsec_springboot/backend/src/main/java/com/realnet/basic1/Services/Testlist_ListFilter1Service.java @@ -0,0 +1,51 @@ +package com.realnet.basic1.Services; +import java.util.*; +import com.realnet.basic1.Repository.TestlistRepository; +import com.realnet.basic1.Entity.Testlist; + +import com.realnet.basic1.Entity.Testlist_ListFilter1; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; + import org.springframework.stereotype.Service; + +@Service + public class Testlist_ListFilter1Service { +@Autowired +private TestlistRepository Repository; + + + + + public List getlistbuilder() { + List list= Repository.findAll(); + ArrayList l = new ArrayList<>(); + for (Testlist data : list) { +Boolean isActive = data.getActive(); + + if (Boolean.TRUE.equals(isActive)) {{ +Testlist_ListFilter1 dummy = new Testlist_ListFilter1(); + dummy.setId(data.getId()); + dummy.setName(data.getName()); + l.add(dummy); +}} +} +return l;} + + + + public List getlistbuilderparam( ) { + List list= Repository.findAll(); + ArrayList l = new ArrayList<>(); + for (Testlist data : list) { +Boolean isActive = data.getActive(); + + if (Boolean.TRUE.equals(isActive)) {{ +Testlist_ListFilter1 dummy = new Testlist_ListFilter1(); + dummy.setId(data.getId()); + dummy.setName(data.getName()); + l.add(dummy); +}} +} +return l;} +} \ No newline at end of file