build_app
This commit is contained in:
		
							parent
							
								
									1685b8727b
								
							
						
					
					
						commit
						085fcbe31c
					
				
							
								
								
									
										6
									
								
								testflutter103-bflutter-d/authsec_mysql/mysql/wf_table/wf_table.sql
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										6
									
								
								testflutter103-bflutter-d/authsec_mysql/mysql/wf_table/wf_table.sql
									
									
									
									
									
										Executable file
									
								
							| @ -0,0 +1,6 @@ | |||||||
|  | CREATE TABLE bflutter.Basicp1(id BIGINT NOT NULL AUTO_INCREMENT, textarea_field VARCHAR(400), paragraph_field VARCHAR(400), textarea VARCHAR(400), paragraph_field2 VARCHAR(400), phone_number2 VARCHAR(400), name VARCHAR(400), number1 int, phone_number VARCHAR(400), number2 int, name2 VARCHAR(400), password_field VARCHAR(400), textarea_field2 VARCHAR(400),  PRIMARY KEY (id)); | ||||||
|  | 
 | ||||||
|  | CREATE TABLE bflutter.Basicp2(id BIGINT NOT NULL AUTO_INCREMENT, datetime_field2 VARCHAR(400), about VARCHAR(400), datetime_field VARCHAR(400), userid_field VARCHAR(400), email_field2 VARCHAR(400), date_field Date, email_field VARCHAR(400), textarea2 VARCHAR(400), date_field2 Date,  PRIMARY KEY (id)); | ||||||
|  | 
 | ||||||
|  | CREATE TABLE bflutter.Basicp3(id BIGINT NOT NULL AUTO_INCREMENT, toggle_switch2 VARCHAR(400), decimal_field2 double, documentsequenc VARCHAR(400), toggle_switch VARCHAR(400), recaptcha VARCHAR(400), percentage_field int, percentage_field2 int, url_field VARCHAR(400), url_field2 VARCHAR(400), decimal_field double, recaptcha2 VARCHAR(400),  PRIMARY KEY (id)); | ||||||
|  | 
 | ||||||
| @ -0,0 +1,120 @@ | |||||||
|  | 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 Basicp1ApiService { | ||||||
|  |   final String baseUrl = ApiConstants.baseUrl; | ||||||
|  | 
 | ||||||
|  |       final BaseNetworkService _helper = NetworkApiService(); | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |    Future<List<Map<String, dynamic>>> getEntities() async { | ||||||
|  | 
 | ||||||
|  |     try { | ||||||
|  |       final response = await _helper.getGetApiResponse('$baseUrl/Basicp1/Basicp1'); | ||||||
|  |       final entities = (response as List).cast<Map<String, dynamic>>(); | ||||||
|  |       return entities; | ||||||
|  |     } catch (e) { | ||||||
|  |       throw Exception('Failed to get all entities: $e'); | ||||||
|  |     } | ||||||
|  |   } | ||||||
|  | Future<List<Map<String, dynamic>>> getAllWithPagination( | ||||||
|  |        int page, int size) async { | ||||||
|  |     try { | ||||||
|  |             final response = | ||||||
|  |           await _helper.getGetApiResponse('$baseUrl/Basicp1/Basicp1/getall/page?page=$page&size=$size'); | ||||||
|  |       final entities = | ||||||
|  |           (response['content'] as List).cast<Map<String, dynamic>>(); | ||||||
|  |       return entities; | ||||||
|  |     } catch (e) { | ||||||
|  |       throw Exception('Failed to get all without pagination: $e'); | ||||||
|  |     } | ||||||
|  |   } | ||||||
|  |   Future<Map<String, dynamic>> createEntity( | ||||||
|  |        Map<String, dynamic> entity) async { | ||||||
|  |     try { | ||||||
|  |             print("in post api$entity"); | ||||||
|  |       final response = | ||||||
|  |           await _helper.getPostApiResponse('$baseUrl/Basicp1/Basicp1', entity); | ||||||
|  | 
 | ||||||
|  |       print(entity); | ||||||
|  | 
 | ||||||
|  |       // Assuming the response is a Map<String, dynamic> | ||||||
|  |       Map<String, dynamic> responseData = response; | ||||||
|  | 
 | ||||||
|  |       return responseData; | ||||||
|  |     } catch (e) { | ||||||
|  |       throw Exception('Failed to create entity: $e'); | ||||||
|  |     } | ||||||
|  |   } | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |   Future<void> updateEntity( int entityId, Map<String, dynamic> entity) async { | ||||||
|  |     try { | ||||||
|  |      await _helper.getPutApiResponse('$baseUrl/Basicp1/Basicp1/$entityId', | ||||||
|  |       entity);                print(entity); | ||||||
|  | 
 | ||||||
|  |     } catch (e) { | ||||||
|  |       throw Exception('Failed to update entity: $e'); | ||||||
|  |     } | ||||||
|  |   } | ||||||
|  | 
 | ||||||
|  |   Future<void> deleteEntity( int entityId) async { | ||||||
|  |     try { | ||||||
|  |  await _helper.getDeleteApiResponse('$baseUrl/Basicp1/Basicp1/$entityId'); | ||||||
|  |     } catch (e) { | ||||||
|  |       throw Exception('Failed to delete entity: $e'); | ||||||
|  |     } | ||||||
|  |   } | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | } | ||||||
| @ -0,0 +1,100 @@ | |||||||
|  | // 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 '../Basicp1_viewModel/Basicp1_view_model_screen.dart'; | ||||||
|  | import 'Basicp1_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 Basicp1CreateEntityScreen extends StatefulWidget { | ||||||
|  |   const Basicp1CreateEntityScreen({super.key}); | ||||||
|  | 
 | ||||||
|  |   @override | ||||||
|  |   _Basicp1CreateEntityScreenState createState() => _Basicp1CreateEntityScreenState(); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | class _Basicp1CreateEntityScreenState extends State<Basicp1CreateEntityScreen> { | ||||||
|  | 
 | ||||||
|  | final Map<String, dynamic> formData = {}; | ||||||
|  |   final _formKey = GlobalKey<FormState>(); | ||||||
|  |    | ||||||
|  |   @override | ||||||
|  |   Widget build(BuildContext context) { | ||||||
|  |     return Consumer<Basicp1ViewModelScreen>( | ||||||
|  |       builder: (context, viewModel, child) { | ||||||
|  |         return EntityCreateScreen( | ||||||
|  |           fields: Basicp1Fields.getFields(context), | ||||||
|  |           onSubmit: (data) => _handleSubmit(data), | ||||||
|  |           title: 'Basicp1', | ||||||
|  |           isLoading: viewModel.isLoading, | ||||||
|  |           errorMessage: | ||||||
|  |               viewModel.errorMessage.isNotEmpty ? viewModel.errorMessage : null, | ||||||
|  |         ); | ||||||
|  |       }, | ||||||
|  |     ); | ||||||
|  |   } | ||||||
|  | 
 | ||||||
|  |   Future<void> _handleSubmit(Map<String, dynamic> formData) async { | ||||||
|  |     final provider = | ||||||
|  |         Provider.of<Basicp1ViewModelScreen>(context, listen: false); | ||||||
|  |     final success = await provider.createEntity(formData); | ||||||
|  | 
 | ||||||
|  |     if (success && mounted) { | ||||||
|  |       Navigator.pop(context); | ||||||
|  |     } | ||||||
|  |   } | ||||||
|  | } | ||||||
| @ -0,0 +1,108 @@ | |||||||
|  | // 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 '../Basicp1_viewModel/Basicp1_view_model_screen.dart'; | ||||||
|  | import 'Basicp1_update_entity_screen.dart'; | ||||||
|  | 
 | ||||||
|  | class Basicp1DetailsScreen extends StatefulWidget { | ||||||
|  |   final Map<String, dynamic> entity; | ||||||
|  | 
 | ||||||
|  |   const Basicp1DetailsScreen({ | ||||||
|  |     super.key, | ||||||
|  |     required this.entity, | ||||||
|  |   }); | ||||||
|  | 
 | ||||||
|  |   @override | ||||||
|  |   State<Basicp1DetailsScreen> createState() => _Basicp1DetailsScreenState(); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | class _Basicp1DetailsScreenState extends State<Basicp1DetailsScreen> { | ||||||
|  |   void _navigateToUpdateScreen(Map<String, dynamic> entity) { | ||||||
|  |     Navigator.push( | ||||||
|  |       context, | ||||||
|  |       MaterialPageRoute( | ||||||
|  |         builder: (context) => ChangeNotifierProvider( | ||||||
|  |           create: (context) => Basicp1ViewModelScreen(), | ||||||
|  |           child: Basicp1UpdateEntityScreen(entity: entity), | ||||||
|  |         ), | ||||||
|  |       ), | ||||||
|  |     ).then((_) { | ||||||
|  |       // Refresh the details screen with updated data | ||||||
|  |       setState(() {}); | ||||||
|  |     }); | ||||||
|  |   } | ||||||
|  | 
 | ||||||
|  |   void _showDeleteDialog(Map<String, dynamic> 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 Basicp1?'), | ||||||
|  |           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<Basicp1ViewModelScreen>(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<Basicp1ViewModelScreen>( | ||||||
|  |       builder: (context, viewModel, child) { | ||||||
|  |         return EntityDetails( | ||||||
|  |           entity: widget.entity, | ||||||
|  |           onEdit: (entity) => _navigateToUpdateScreen(entity), | ||||||
|  |           onDelete: (entity) => _showDeleteDialog(entity), | ||||||
|  |           title: 'Basicp1', | ||||||
|  |           displayFields: [ | ||||||
|  |   {'key': 'name', 'label': 'name', 'type': 'text'}, | ||||||
|  | 
 | ||||||
|  |   {'key': 'name2', 'label': 'name2', 'type': 'text'}, | ||||||
|  | 
 | ||||||
|  |   {'key': 'number1', 'label': 'number1', 'type': 'number'}, | ||||||
|  | 
 | ||||||
|  |   {'key': 'number2', 'label': 'number2', 'type': 'number'}, | ||||||
|  | 
 | ||||||
|  |   {'key': 'phone_number', 'label': 'Phone Number', 'type': 'phone'}, | ||||||
|  | 
 | ||||||
|  |   {'key': 'phone_number2', 'label': 'Phone Number2', 'type': 'phone'}, | ||||||
|  | 
 | ||||||
|  |   {'key': 'paragraph_field', 'label': 'Paragraph Field', 'type': 'paragraph'}, | ||||||
|  | 
 | ||||||
|  |   {'key': 'paragraph_field2', 'label': 'Paragraph Field2', 'type': 'paragraph'}, | ||||||
|  | 
 | ||||||
|  |   {'key': 'password_field', 'label': 'Password Field', 'type': 'password'}, | ||||||
|  | 
 | ||||||
|  |   {'key': 'textarea', 'label': 'Textarea', 'type': 'textarea'}, | ||||||
|  | 
 | ||||||
|  |   {'key': 'textarea_field', 'label': 'Textarea Field', 'type': 'textarea'}, | ||||||
|  | 
 | ||||||
|  |   {'key': 'textarea_field2', 'label': 'Textarea Field2', 'type': 'textarea'}, | ||||||
|  | 
 | ||||||
|  |           ], | ||||||
|  |           isLoading: viewModel.isLoading, | ||||||
|  |         ); | ||||||
|  |       }, | ||||||
|  |     ); | ||||||
|  |   } | ||||||
|  | } | ||||||
| @ -0,0 +1,168 @@ | |||||||
|  | // 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 'Basicp1_create_entity_screen.dart'; | ||||||
|  | import 'Basicp1_update_entity_screen.dart'; | ||||||
|  | import '../Basicp1_viewModel/Basicp1_view_model_screen.dart'; | ||||||
|  | import 'Basicp1_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 Basicp1_entity_list_screen extends StatefulWidget { | ||||||
|  |   static const String routeName = '/entity-list'; | ||||||
|  | 
 | ||||||
|  |   @override | ||||||
|  |   _Basicp1_entity_list_screenState createState() => _Basicp1_entity_list_screenState(); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | class _Basicp1_entity_list_screenState extends State<Basicp1_entity_list_screen> { | ||||||
|  |   @override | ||||||
|  |   void initState() { | ||||||
|  |     super.initState(); | ||||||
|  |     _loadData(); | ||||||
|  |   } | ||||||
|  | 
 | ||||||
|  |   void _loadData() { | ||||||
|  |     WidgetsBinding.instance.addPostFrameCallback((_) { | ||||||
|  |       if (mounted) { | ||||||
|  |         final vm = Provider.of<Basicp1ViewModelScreen>(context, listen: false); | ||||||
|  |         vm.getAllWithPagination(refresh: true); | ||||||
|  |       } | ||||||
|  |     }); | ||||||
|  |   } | ||||||
|  | 
 | ||||||
|  |   void _navigateToCreateScreen() { | ||||||
|  |     Navigator.push( | ||||||
|  |       context, | ||||||
|  |       MaterialPageRoute( | ||||||
|  |         builder: (context) => ChangeNotifierProvider( | ||||||
|  |           create: (context) => Basicp1ViewModelScreen(), | ||||||
|  |           child: const Basicp1CreateEntityScreen(), | ||||||
|  |         ), | ||||||
|  |       ), | ||||||
|  |     ).then((_) { | ||||||
|  |       final vm = Provider.of<Basicp1ViewModelScreen>(context, listen: false); | ||||||
|  |       vm.refreshData(); | ||||||
|  |     }); | ||||||
|  |   } | ||||||
|  | 
 | ||||||
|  |   void _navigateToUpdateScreen(Map<String, dynamic> entity) { | ||||||
|  |     Navigator.push( | ||||||
|  |       context, | ||||||
|  |       MaterialPageRoute( | ||||||
|  |         builder: (context) => ChangeNotifierProvider( | ||||||
|  |           create: (context) => Basicp1ViewModelScreen(), | ||||||
|  |           child: Basicp1UpdateEntityScreen(entity: entity), | ||||||
|  |         ), | ||||||
|  |       ), | ||||||
|  |     ).then((_) { | ||||||
|  |       final vm = Provider.of<Basicp1ViewModelScreen>(context, listen: false); | ||||||
|  |       vm.refreshData(); | ||||||
|  |     }); | ||||||
|  |   } | ||||||
|  | 
 | ||||||
|  |   void _navigateToDetailsScreen(Map<String, dynamic> entity) { | ||||||
|  |     Navigator.push( | ||||||
|  |       context, | ||||||
|  |       MaterialPageRoute( | ||||||
|  |         builder: (context) => ChangeNotifierProvider( | ||||||
|  |           create: (context) => Basicp1ViewModelScreen(), | ||||||
|  |           child: Basicp1DetailsScreen(entity: entity), | ||||||
|  |         ), | ||||||
|  |       ), | ||||||
|  |     ); | ||||||
|  |   } | ||||||
|  | 
 | ||||||
|  |   void _showDeleteDialog(Map<String, dynamic> 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 Basicp1?'), | ||||||
|  |           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<Basicp1ViewModelScreen>(parentContext, listen: false); | ||||||
|  |                 await vm.deleteEntity(entity['id']); | ||||||
|  |               }, | ||||||
|  |             ), | ||||||
|  |           ], | ||||||
|  |         ); | ||||||
|  |       }, | ||||||
|  |     ); | ||||||
|  |   } | ||||||
|  | 
 | ||||||
|  |   @override | ||||||
|  |   Widget build(BuildContext context) { | ||||||
|  |     return Consumer<Basicp1ViewModelScreen>( | ||||||
|  |       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.searchbasicp1(query), | ||||||
|  |           onEdit: (entity) => _navigateToUpdateScreen(entity), | ||||||
|  |           onDelete: (entity) => _showDeleteDialog(entity), | ||||||
|  |           onTap: (entity) => _navigateToDetailsScreen(entity), | ||||||
|  |           onRefresh: () => viewModel.refreshData(), | ||||||
|  |           onLoadMore: () => viewModel.getAllWithPagination(), | ||||||
|  |           title: 'Basicp1', | ||||||
|  |           onAddNew: _navigateToCreateScreen, | ||||||
|  |           displayFields: [ | ||||||
|  |   {'key': 'name', 'label': 'name', 'type': 'text'}, | ||||||
|  | 
 | ||||||
|  |   {'key': 'name2', 'label': 'name2', 'type': 'text'}, | ||||||
|  | 
 | ||||||
|  |   {'key': 'number1', 'label': 'number1', 'type': 'number'}, | ||||||
|  | 
 | ||||||
|  |   {'key': 'number2', 'label': 'number2', 'type': 'number'}, | ||||||
|  | 
 | ||||||
|  |   {'key': 'phone_number', 'label': 'Phone Number', 'type': 'phone'}, | ||||||
|  | 
 | ||||||
|  |   {'key': 'phone_number2', 'label': 'Phone Number2', 'type': 'phone'}, | ||||||
|  | 
 | ||||||
|  |   {'key': 'paragraph_field', 'label': 'Paragraph Field', 'type': 'paragraph'}, | ||||||
|  | 
 | ||||||
|  |   {'key': 'paragraph_field2', 'label': 'Paragraph Field2', 'type': 'paragraph'}, | ||||||
|  | 
 | ||||||
|  |   {'key': 'password_field', 'label': 'Password Field', 'type': 'password'}, | ||||||
|  | 
 | ||||||
|  |   {'key': 'textarea', 'label': 'Textarea', 'type': 'textarea'}, | ||||||
|  | 
 | ||||||
|  |   {'key': 'textarea_field', 'label': 'Textarea Field', 'type': 'textarea'}, | ||||||
|  | 
 | ||||||
|  |   {'key': 'textarea_field2', 'label': 'Textarea Field2', 'type': 'textarea'}, | ||||||
|  | 
 | ||||||
|  |           ], | ||||||
|  |         ); | ||||||
|  |       }, | ||||||
|  |     ); | ||||||
|  |   } | ||||||
|  | } | ||||||
| @ -0,0 +1,166 @@ | |||||||
|  | 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 '../Basicp1_viewModel/Basicp1_view_model_screen.dart';/// Field definitions for Basicp1 entity | ||||||
|  | /// This defines the structure and validation for Basicp1 forms | ||||||
|  | class Basicp1Fields { | ||||||
|  |   /// Get field definitions for Basicp1 entity | ||||||
|  |   static List<BaseField> getFields(BuildContext context) { | ||||||
|  |     final viewModel = | ||||||
|  |         Provider.of<Basicp1ViewModelScreen>(context, listen: false); | ||||||
|  |     return [ | ||||||
|  |       // Basic Information | ||||||
|  |  CustomTextField( | ||||||
|  |         fieldKey: 'name', | ||||||
|  |         label: 'name', | ||||||
|  |         hint: 'Enter name', | ||||||
|  |         isRequired: true, | ||||||
|  |         maxLength: 50, | ||||||
|  |       ), | ||||||
|  | 
 | ||||||
|  |  CustomTextField( | ||||||
|  |         fieldKey: 'name2', | ||||||
|  |         label: 'name2', | ||||||
|  |         hint: 'Enter name2', | ||||||
|  |         isRequired: true, | ||||||
|  |         maxLength: 50, | ||||||
|  |       ), | ||||||
|  | 
 | ||||||
|  |   // Number Fields | ||||||
|  |       NumberField( | ||||||
|  |         fieldKey: 'number1', | ||||||
|  |         label: 'number1', | ||||||
|  |         hint: 'Enter number1', | ||||||
|  |         isRequired: false, | ||||||
|  |         min: 0, | ||||||
|  |         decimalPlaces: 0, | ||||||
|  |       ), | ||||||
|  | 
 | ||||||
|  |   // Number Fields | ||||||
|  |       NumberField( | ||||||
|  |         fieldKey: 'number2', | ||||||
|  |         label: 'number2', | ||||||
|  |         hint: 'Enter number2', | ||||||
|  |         isRequired: false, | ||||||
|  |         min: 0, | ||||||
|  |         decimalPlaces: 0, | ||||||
|  |       ), | ||||||
|  | 
 | ||||||
|  |  PhoneField( | ||||||
|  |         fieldKey: 'phone_number', | ||||||
|  |         label: 'Phone Number', | ||||||
|  |         hint: 'Enter Phone Number', | ||||||
|  |         isRequired: false, | ||||||
|  |         countryCode: '+91', | ||||||
|  |       ), | ||||||
|  | 
 | ||||||
|  |  PhoneField( | ||||||
|  |         fieldKey: 'phone_number2', | ||||||
|  |         label: 'Phone Number2', | ||||||
|  |         hint: 'Enter Phone Number2', | ||||||
|  |         isRequired: false, | ||||||
|  |         countryCode: '+91', | ||||||
|  |       ), | ||||||
|  | 
 | ||||||
|  | CustomTextField( | ||||||
|  |         fieldKey: 'paragraph_field', | ||||||
|  |         label: 'Paragraph Field', | ||||||
|  |         hint: 'Enter Paragraph Field', | ||||||
|  |         isRequired: false, | ||||||
|  |         maxLength: 500, | ||||||
|  |       ), | ||||||
|  | 
 | ||||||
|  | CustomTextField( | ||||||
|  |         fieldKey: 'paragraph_field2', | ||||||
|  |         label: 'Paragraph Field2', | ||||||
|  |         hint: 'Enter Paragraph Field2', | ||||||
|  |         isRequired: false, | ||||||
|  |         maxLength: 500, | ||||||
|  |       ), | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |       // Password Fields (dynamic names supported via fieldKey) | ||||||
|  |       PasswordField( | ||||||
|  |         fieldKey: 'password_field', | ||||||
|  |         label: 'Password Field', | ||||||
|  |         hint: 'Enter Password Field', | ||||||
|  |         isRequired: false, | ||||||
|  |         maxLength: 50, | ||||||
|  |         groupId: 'p1', | ||||||
|  |       ), | ||||||
|  |       PasswordField( | ||||||
|  |         fieldKey: 'confirm+password_field', | ||||||
|  |         label: 'Confirm Password Field', | ||||||
|  |         hint: 'Confirm Password Field', | ||||||
|  |         isRequired: false, | ||||||
|  |         maxLength: 50, | ||||||
|  |         groupId: 'p1', | ||||||
|  |         isConfirm: true, | ||||||
|  |       ), | ||||||
|  | 
 | ||||||
|  | CustomTextField( | ||||||
|  |         fieldKey: 'textarea', | ||||||
|  |         label: 'Textarea', | ||||||
|  |         hint: 'Enter Textarea', | ||||||
|  |         isRequired: false, | ||||||
|  |         maxLength: 1000, | ||||||
|  |       ), | ||||||
|  | 
 | ||||||
|  | CustomTextField( | ||||||
|  |         fieldKey: 'textarea_field', | ||||||
|  |         label: 'Textarea Field', | ||||||
|  |         hint: 'Enter Textarea Field', | ||||||
|  |         isRequired: false, | ||||||
|  |         maxLength: 1000, | ||||||
|  |       ), | ||||||
|  | 
 | ||||||
|  | CustomTextField( | ||||||
|  |         fieldKey: 'textarea_field2', | ||||||
|  |         label: 'Textarea Field2', | ||||||
|  |         hint: 'Enter Textarea Field2', | ||||||
|  |         isRequired: false, | ||||||
|  |         maxLength: 1000, | ||||||
|  |       ), | ||||||
|  | 
 | ||||||
|  |     ]; | ||||||
|  |   } | ||||||
|  | } | ||||||
| @ -0,0 +1,95 @@ | |||||||
|  | // ignore_for_file: use_build_context_synchronously | ||||||
|  | import 'dart:convert'; | ||||||
|  | import 'package:provider/provider.dart'; | ||||||
|  | import '../Basicp1_viewModel/Basicp1_view_model_screen.dart'; | ||||||
|  | import 'package:base_project/BuilderField/shared/ui/entity_screens.dart'; | ||||||
|  | import 'Basicp1_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 Basicp1UpdateEntityScreen extends StatefulWidget { | ||||||
|  |     final Map<String, dynamic> entity; | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |   Basicp1UpdateEntityScreen({required this.entity}); | ||||||
|  | 
 | ||||||
|  |   @override | ||||||
|  |   _Basicp1UpdateEntityScreenState createState() => _Basicp1UpdateEntityScreenState(); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | class _Basicp1UpdateEntityScreenState extends State<Basicp1UpdateEntityScreen> { | ||||||
|  |   final _formKey = GlobalKey<FormState>(); | ||||||
|  | 
 | ||||||
|  | @override | ||||||
|  |   Widget build(BuildContext context) { | ||||||
|  |     return Consumer<Basicp1ViewModelScreen>( | ||||||
|  |       builder: (context, viewModel, child) { | ||||||
|  | // Start with all fields, then remove upload fields (generic filter by keys) | ||||||
|  |         final Set<String> hiddenKeys = {  | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |  }; | ||||||
|  |         final fields = Basicp1Fields.getFields(context) | ||||||
|  |             .where((f) => !hiddenKeys.contains(f.fieldKey)) | ||||||
|  |             .toList();        return EntityUpdateScreen( | ||||||
|  |           fields: fields, | ||||||
|  |           initialData: widget.entity, | ||||||
|  |           onSubmit: (data) => _handleSubmit(data), | ||||||
|  |           title: 'Basicp1', | ||||||
|  |           isLoading: viewModel.isLoading, | ||||||
|  |           errorMessage: | ||||||
|  |               viewModel.errorMessage.isNotEmpty ? viewModel.errorMessage : null, | ||||||
|  |         ); | ||||||
|  |       }, | ||||||
|  |     ); | ||||||
|  |   } | ||||||
|  | 
 | ||||||
|  |   Future<void> _handleSubmit(Map<String, dynamic> formData) async { | ||||||
|  |     final provider = | ||||||
|  |         Provider.of<Basicp1ViewModelScreen>(context, listen: false); | ||||||
|  |     final success = await provider.updateEntity(widget.entity['id'], formData); | ||||||
|  | 
 | ||||||
|  |     if (success && mounted) { | ||||||
|  |       Navigator.pop(context); | ||||||
|  |     } | ||||||
|  |   } | ||||||
|  | } | ||||||
| @ -0,0 +1,113 @@ | |||||||
|  | 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 Basicp1RepoScreen { | ||||||
|  | 
 | ||||||
|  |   final String baseUrl = ApiConstants.baseUrl; | ||||||
|  |   final BaseNetworkService _helper = NetworkApiService(); | ||||||
|  |   final String _endpointPath = '/Basicp1/Basicp1'; | ||||||
|  | 
 | ||||||
|  |   Future<ApiResponse<List<Map<String, dynamic>>>> getEntities() async { | ||||||
|  |     try { | ||||||
|  |       final response = | ||||||
|  |           await _helper.getGetApiResponse('$baseUrl$_endpointPath'); | ||||||
|  |       print('Response received: $response'); | ||||||
|  |       List<Map<String, dynamic>> entities = const []; | ||||||
|  |       if (response is List) { | ||||||
|  |         entities = response | ||||||
|  |             .whereType<Map>() | ||||||
|  |             .map((e) => Map<String, dynamic>.from(e as Map)) | ||||||
|  |             .toList(); | ||||||
|  |       } else if (response is Map<String, dynamic>) { | ||||||
|  |         final dynamic content = response['content']; | ||||||
|  |         if (content is List) { | ||||||
|  |           entities = content | ||||||
|  |               .whereType<Map>() | ||||||
|  |               .map((e) => Map<String, dynamic>.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<ApiResponse<List<Map<String, dynamic>>>> getAllWithPagination( | ||||||
|  |       int page, int size) async { | ||||||
|  |     try { | ||||||
|  |       final response = await _helper.getGetApiResponse( | ||||||
|  |           '$baseUrl$_endpointPath/getall/page?page=$page&size=$size'); | ||||||
|  | 
 | ||||||
|  |       if (response is Map<String, dynamic> && response['content'] is List) { | ||||||
|  |         final List<Map<String, dynamic>> entities = | ||||||
|  |             (response['content'] as List).cast<Map<String, dynamic>>().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<ApiResponse<Map<String, dynamic>>> createEntity( | ||||||
|  |       Map<String, dynamic> entity) async { | ||||||
|  |     try { | ||||||
|  |       print("in post api$entity"); | ||||||
|  |       final response = | ||||||
|  |           await _helper.getPostApiResponse('$baseUrl$_endpointPath', entity); | ||||||
|  |       return ApiResponse.success(response as Map<String, dynamic>); | ||||||
|  |     } catch (e) { | ||||||
|  |       return ApiResponse.error('Failed to create entity: $e'); | ||||||
|  |     } | ||||||
|  |   } | ||||||
|  | 
 | ||||||
|  |   Future<ApiResponse<Map<String, dynamic>>> updateEntity( | ||||||
|  |       int entityId, Map<String, dynamic> entity) async { | ||||||
|  |     try { | ||||||
|  |       final response = await _helper.getPutApiResponse( | ||||||
|  |           '$baseUrl$_endpointPath/$entityId', entity); | ||||||
|  |       return ApiResponse.success(response as Map<String, dynamic>); | ||||||
|  |     } catch (e) { | ||||||
|  |       return ApiResponse.error('Failed to update entity: $e'); | ||||||
|  |     } | ||||||
|  |   } | ||||||
|  | 
 | ||||||
|  |   Future<ApiResponse<void>> 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'); | ||||||
|  |     } | ||||||
|  |   } | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | } | ||||||
| @ -0,0 +1,452 @@ | |||||||
|  | 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 '../Basicp1_Repo/Basicp1_repo_screen.dart'; | ||||||
|  | 
 | ||||||
|  | class Basicp1ViewModelScreen extends ChangeNotifier{ | ||||||
|  |   final Basicp1RepoScreen repo = Basicp1RepoScreen(); | ||||||
|  | 
 | ||||||
|  |   | ||||||
|  |   // State variables | ||||||
|  |   List<Map<String, dynamic>> _basicp1List = []; | ||||||
|  |   List<Map<String, dynamic>> _filteredList = []; | ||||||
|  |   bool _isLoading = false; | ||||||
|  |   String _errorMessage = ''; | ||||||
|  |   int _currentPage = 0; | ||||||
|  |   int _pageSize = 10; | ||||||
|  |   bool _hasMoreData = true; | ||||||
|  |   String _searchQuery = ''; | ||||||
|  | 
 | ||||||
|  |   // Getters | ||||||
|  |   List<Map<String, dynamic>> get basicp1List => _basicp1List; | ||||||
|  |   List<Map<String, dynamic>> 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 basicp1 list | ||||||
|  |   Future<void> getEntities() async { | ||||||
|  |     _setLoading(true); | ||||||
|  |     _setError(''); | ||||||
|  | 
 | ||||||
|  |     try { | ||||||
|  |       final response = await repo.getEntities(); | ||||||
|  | 
 | ||||||
|  |       if (response.status == Status.SUCCESS) { | ||||||
|  |         _basicp1List = response.data ?? []; | ||||||
|  |         _filteredList = List.from(_basicp1List); | ||||||
|  |         _currentPage = 0; | ||||||
|  |         _hasMoreData = true; | ||||||
|  |       } else { | ||||||
|  |         _setError(response.message ?? 'Failed to fetch basicp1 list'); | ||||||
|  |       } | ||||||
|  |     } catch (e) { | ||||||
|  |       _setError('Failed to fetch basicp1 list: $e'); | ||||||
|  |     } finally { | ||||||
|  |       _setLoading(false); | ||||||
|  |     } | ||||||
|  |   } | ||||||
|  | 
 | ||||||
|  |   // Get basicp1 list with pagination | ||||||
|  |   Future<void> getAllWithPagination({bool refresh = false}) async { | ||||||
|  |     if (refresh) { | ||||||
|  |       _currentPage = 0; | ||||||
|  |       _basicp1List.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) { | ||||||
|  |           _basicp1List = newItems; | ||||||
|  |         } else { | ||||||
|  |           _basicp1List.addAll(newItems); | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |         _filteredList = List.from(_basicp1List); | ||||||
|  |         _currentPage++; | ||||||
|  | 
 | ||||||
|  |         // Check if we have more data | ||||||
|  |         _hasMoreData = newItems.length == _pageSize; | ||||||
|  |       } else { | ||||||
|  |         _setError(response.message ?? 'Failed to fetch Basicp1 list'); | ||||||
|  |       } | ||||||
|  |     } catch (e) { | ||||||
|  |       _setError('Failed to fetch basicp1 list: $e'); | ||||||
|  |     } finally { | ||||||
|  |       _setLoading(false); | ||||||
|  |     } | ||||||
|  |   } | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |   // Create Basicp1 | ||||||
|  |   Future<bool> createEntity(Map<String, dynamic> 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: 'basicp1 created successfully', | ||||||
|  |           toastType: ToastType.success, | ||||||
|  |         ); | ||||||
|  | 
 | ||||||
|  |         // Refresh the list | ||||||
|  |         await getEntities(); | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |         return true; | ||||||
|  |       } else { | ||||||
|  |         _setError(response.message ?? 'Failed to create Basicp1'); | ||||||
|  |         ToastMessageUtil.showToast( | ||||||
|  |           message: response.message ?? 'Failed to create Basicp1', | ||||||
|  |           toastType: ToastType.error, | ||||||
|  |         ); | ||||||
|  |         return false; | ||||||
|  |       } | ||||||
|  |     } catch (e) { | ||||||
|  |       _setError('Failed to create basicp1: $e'); | ||||||
|  |       ToastMessageUtil.showToast( | ||||||
|  |         message: 'Failed to create Basicp1: $e', | ||||||
|  |         toastType: ToastType.error, | ||||||
|  |       ); | ||||||
|  |       return false; | ||||||
|  |     } finally { | ||||||
|  |       _setLoading(false); | ||||||
|  |     } | ||||||
|  |   } | ||||||
|  | 
 | ||||||
|  |   // Update basicp1 | ||||||
|  |   Future<bool> updateEntity(int id, Map<String, dynamic> entity) async { | ||||||
|  |     _setLoading(true); | ||||||
|  |     _setError(''); | ||||||
|  | 
 | ||||||
|  |     try { | ||||||
|  |       final response = await repo.updateEntity(id, entity); | ||||||
|  | 
 | ||||||
|  |       if (response.status == Status.SUCCESS) { | ||||||
|  |         ToastMessageUtil.showToast( | ||||||
|  |           message: 'Basicp1 updated successfully', | ||||||
|  |           toastType: ToastType.success, | ||||||
|  |         ); | ||||||
|  | 
 | ||||||
|  |         // Update the item in the list | ||||||
|  |         final index = _basicp1List.indexWhere((item) => item['id'] == id); | ||||||
|  |         if (index != -1) { | ||||||
|  |           _basicp1List[index] = response.data!; | ||||||
|  |           _filteredList = List.from(_basicp1List); | ||||||
|  |           notifyListeners(); | ||||||
|  |         } | ||||||
|  |         return true; | ||||||
|  |       } else { | ||||||
|  |         _setError(response.message ?? 'Failed to update Basicp1'); | ||||||
|  |         ToastMessageUtil.showToast( | ||||||
|  |           message: response.message ?? 'Failed to update Basicp1', | ||||||
|  |           toastType: ToastType.error, | ||||||
|  |         ); | ||||||
|  |         return false; | ||||||
|  |       } | ||||||
|  |     } catch (e) { | ||||||
|  |       _setError('Failed to update basicp1: $e'); | ||||||
|  |       ToastMessageUtil.showToast( | ||||||
|  |         message: 'Failed to update Basicp1: $e', | ||||||
|  |         toastType: ToastType.error, | ||||||
|  |       ); | ||||||
|  |       return false; | ||||||
|  |     } finally { | ||||||
|  |       _setLoading(false); | ||||||
|  |     } | ||||||
|  |   } | ||||||
|  | 
 | ||||||
|  |   // Delete basicp1 | ||||||
|  |   Future<bool> deleteEntity(int id) async { | ||||||
|  |     _setLoading(true); | ||||||
|  |     _setError(''); | ||||||
|  | 
 | ||||||
|  |     try { | ||||||
|  |       final response = await repo.deleteEntity(id); | ||||||
|  | 
 | ||||||
|  |       if (response.status == Status.SUCCESS) { | ||||||
|  |         ToastMessageUtil.showToast( | ||||||
|  |           message: 'Basicp1 deleted successfully', | ||||||
|  |           toastType: ToastType.success, | ||||||
|  |         ); | ||||||
|  | 
 | ||||||
|  |         // Remove the item from the list | ||||||
|  |         _basicp1List.removeWhere((item) => item['id'] == id); | ||||||
|  |         _filteredList = List.from(_basicp1List); | ||||||
|  |         notifyListeners(); | ||||||
|  |         return true; | ||||||
|  |       } else { | ||||||
|  |         _setError(response.message ?? 'Failed to delete Basicp1'); | ||||||
|  |         ToastMessageUtil.showToast( | ||||||
|  |           message: response.message ?? 'Failed to delete Basicp1', | ||||||
|  |           toastType: ToastType.error, | ||||||
|  |         ); | ||||||
|  |         return false; | ||||||
|  |       } | ||||||
|  |     } catch (e) { | ||||||
|  |       _setError('Failed to delete basicp1: $e'); | ||||||
|  |       ToastMessageUtil.showToast( | ||||||
|  |         message: 'Failed to delete Basicp1: $e', | ||||||
|  |         toastType: ToastType.error, | ||||||
|  |       ); | ||||||
|  |       return false; | ||||||
|  |     } finally { | ||||||
|  |       _setLoading(false); | ||||||
|  |     } | ||||||
|  |   } | ||||||
|  | 
 | ||||||
|  |   // Search basicp1 | ||||||
|  |   void searchbasicp1(String query) { | ||||||
|  |     _searchQuery = query; | ||||||
|  | 
 | ||||||
|  |     if (query.isEmpty) { | ||||||
|  |       _filteredList = List.from(_basicp1List); | ||||||
|  |     } else { | ||||||
|  |       _filteredList = _basicp1List.where((item) { | ||||||
|  |         return | ||||||
|  | 
 | ||||||
|  |               | ||||||
|  | (item['name']?.toString().toLowerCase().contains(query.toLowerCase()) ??false) || | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |               | ||||||
|  | (item['name2']?.toString().toLowerCase().contains(query.toLowerCase()) ??false) || | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |               | ||||||
|  | (item['number1']?.toString().toLowerCase().contains(query.toLowerCase()) ??false) || | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |               | ||||||
|  | (item['number2']?.toString().toLowerCase().contains(query.toLowerCase()) ??false) || | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |               | ||||||
|  | (item['phone_number']?.toString().toLowerCase().contains(query.toLowerCase()) ??false) || | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |               | ||||||
|  | (item['phone_number2']?.toString().toLowerCase().contains(query.toLowerCase()) ??false) || | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |               | ||||||
|  | (item['paragraph_field']?.toString().toLowerCase().contains(query.toLowerCase()) ??false) || | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |               | ||||||
|  | (item['paragraph_field2']?.toString().toLowerCase().contains(query.toLowerCase()) ??false) || | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |               | ||||||
|  | (item['password_field']?.toString().toLowerCase().contains(query.toLowerCase()) ??false) || | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |               | ||||||
|  | (item['textarea']?.toString().toLowerCase().contains(query.toLowerCase()) ??false) || | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |               | ||||||
|  | (item['textarea_field']?.toString().toLowerCase().contains(query.toLowerCase()) ??false) || | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |               | ||||||
|  | (item['textarea_field2']?.toString().toLowerCase().contains(query.toLowerCase()) ??false)  | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | ; | ||||||
|  |       }).toList(); | ||||||
|  |     } | ||||||
|  |     notifyListeners(); | ||||||
|  |   } | ||||||
|  | 
 | ||||||
|  |   // Clear search | ||||||
|  |   void clearSearch() { | ||||||
|  |     _searchQuery = ''; | ||||||
|  |     _filteredList = List.from(_basicp1List); | ||||||
|  |     notifyListeners(); | ||||||
|  |   } | ||||||
|  | 
 | ||||||
|  |   // Refresh data | ||||||
|  |   Future<void> refreshData() async { | ||||||
|  |     await getAllWithPagination(refresh: true); | ||||||
|  |   } | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | } | ||||||
| @ -0,0 +1,108 @@ | |||||||
|  | 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 Basicp2ApiService { | ||||||
|  |   final String baseUrl = ApiConstants.baseUrl; | ||||||
|  | 
 | ||||||
|  |       final BaseNetworkService _helper = NetworkApiService(); | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |    Future<List<Map<String, dynamic>>> getEntities() async { | ||||||
|  | 
 | ||||||
|  |     try { | ||||||
|  |       final response = await _helper.getGetApiResponse('$baseUrl/Basicp2/Basicp2'); | ||||||
|  |       final entities = (response as List).cast<Map<String, dynamic>>(); | ||||||
|  |       return entities; | ||||||
|  |     } catch (e) { | ||||||
|  |       throw Exception('Failed to get all entities: $e'); | ||||||
|  |     } | ||||||
|  |   } | ||||||
|  | Future<List<Map<String, dynamic>>> getAllWithPagination( | ||||||
|  |        int page, int size) async { | ||||||
|  |     try { | ||||||
|  |             final response = | ||||||
|  |           await _helper.getGetApiResponse('$baseUrl/Basicp2/Basicp2/getall/page?page=$page&size=$size'); | ||||||
|  |       final entities = | ||||||
|  |           (response['content'] as List).cast<Map<String, dynamic>>(); | ||||||
|  |       return entities; | ||||||
|  |     } catch (e) { | ||||||
|  |       throw Exception('Failed to get all without pagination: $e'); | ||||||
|  |     } | ||||||
|  |   } | ||||||
|  |   Future<Map<String, dynamic>> createEntity( | ||||||
|  |        Map<String, dynamic> entity) async { | ||||||
|  |     try { | ||||||
|  |             print("in post api$entity"); | ||||||
|  |       final response = | ||||||
|  |           await _helper.getPostApiResponse('$baseUrl/Basicp2/Basicp2', entity); | ||||||
|  | 
 | ||||||
|  |       print(entity); | ||||||
|  | 
 | ||||||
|  |       // Assuming the response is a Map<String, dynamic> | ||||||
|  |       Map<String, dynamic> responseData = response; | ||||||
|  | 
 | ||||||
|  |       return responseData; | ||||||
|  |     } catch (e) { | ||||||
|  |       throw Exception('Failed to create entity: $e'); | ||||||
|  |     } | ||||||
|  |   } | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |   Future<void> updateEntity( int entityId, Map<String, dynamic> entity) async { | ||||||
|  |     try { | ||||||
|  |      await _helper.getPutApiResponse('$baseUrl/Basicp2/Basicp2/$entityId', | ||||||
|  |       entity);                print(entity); | ||||||
|  | 
 | ||||||
|  |     } catch (e) { | ||||||
|  |       throw Exception('Failed to update entity: $e'); | ||||||
|  |     } | ||||||
|  |   } | ||||||
|  | 
 | ||||||
|  |   Future<void> deleteEntity( int entityId) async { | ||||||
|  |     try { | ||||||
|  |  await _helper.getDeleteApiResponse('$baseUrl/Basicp2/Basicp2/$entityId'); | ||||||
|  |     } catch (e) { | ||||||
|  |       throw Exception('Failed to delete entity: $e'); | ||||||
|  |     } | ||||||
|  |   } | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | } | ||||||
| @ -0,0 +1,94 @@ | |||||||
|  | // 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 '../Basicp2_viewModel/Basicp2_view_model_screen.dart'; | ||||||
|  | import 'Basicp2_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 Basicp2CreateEntityScreen extends StatefulWidget { | ||||||
|  |   const Basicp2CreateEntityScreen({super.key}); | ||||||
|  | 
 | ||||||
|  |   @override | ||||||
|  |   _Basicp2CreateEntityScreenState createState() => _Basicp2CreateEntityScreenState(); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | class _Basicp2CreateEntityScreenState extends State<Basicp2CreateEntityScreen> { | ||||||
|  | 
 | ||||||
|  | final Map<String, dynamic> formData = {}; | ||||||
|  |   final _formKey = GlobalKey<FormState>(); | ||||||
|  |    | ||||||
|  |   @override | ||||||
|  |   Widget build(BuildContext context) { | ||||||
|  |     return Consumer<Basicp2ViewModelScreen>( | ||||||
|  |       builder: (context, viewModel, child) { | ||||||
|  |         return EntityCreateScreen( | ||||||
|  |           fields: Basicp2Fields.getFields(context), | ||||||
|  |           onSubmit: (data) => _handleSubmit(data), | ||||||
|  |           title: 'Basicp2', | ||||||
|  |           isLoading: viewModel.isLoading, | ||||||
|  |           errorMessage: | ||||||
|  |               viewModel.errorMessage.isNotEmpty ? viewModel.errorMessage : null, | ||||||
|  |         ); | ||||||
|  |       }, | ||||||
|  |     ); | ||||||
|  |   } | ||||||
|  | 
 | ||||||
|  |   Future<void> _handleSubmit(Map<String, dynamic> formData) async { | ||||||
|  |     final provider = | ||||||
|  |         Provider.of<Basicp2ViewModelScreen>(context, listen: false); | ||||||
|  |     final success = await provider.createEntity(formData); | ||||||
|  | 
 | ||||||
|  |     if (success && mounted) { | ||||||
|  |       Navigator.pop(context); | ||||||
|  |     } | ||||||
|  |   } | ||||||
|  | } | ||||||
| @ -0,0 +1,102 @@ | |||||||
|  | // 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 '../Basicp2_viewModel/Basicp2_view_model_screen.dart'; | ||||||
|  | import 'Basicp2_update_entity_screen.dart'; | ||||||
|  | 
 | ||||||
|  | class Basicp2DetailsScreen extends StatefulWidget { | ||||||
|  |   final Map<String, dynamic> entity; | ||||||
|  | 
 | ||||||
|  |   const Basicp2DetailsScreen({ | ||||||
|  |     super.key, | ||||||
|  |     required this.entity, | ||||||
|  |   }); | ||||||
|  | 
 | ||||||
|  |   @override | ||||||
|  |   State<Basicp2DetailsScreen> createState() => _Basicp2DetailsScreenState(); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | class _Basicp2DetailsScreenState extends State<Basicp2DetailsScreen> { | ||||||
|  |   void _navigateToUpdateScreen(Map<String, dynamic> entity) { | ||||||
|  |     Navigator.push( | ||||||
|  |       context, | ||||||
|  |       MaterialPageRoute( | ||||||
|  |         builder: (context) => ChangeNotifierProvider( | ||||||
|  |           create: (context) => Basicp2ViewModelScreen(), | ||||||
|  |           child: Basicp2UpdateEntityScreen(entity: entity), | ||||||
|  |         ), | ||||||
|  |       ), | ||||||
|  |     ).then((_) { | ||||||
|  |       // Refresh the details screen with updated data | ||||||
|  |       setState(() {}); | ||||||
|  |     }); | ||||||
|  |   } | ||||||
|  | 
 | ||||||
|  |   void _showDeleteDialog(Map<String, dynamic> 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 Basicp2?'), | ||||||
|  |           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<Basicp2ViewModelScreen>(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<Basicp2ViewModelScreen>( | ||||||
|  |       builder: (context, viewModel, child) { | ||||||
|  |         return EntityDetails( | ||||||
|  |           entity: widget.entity, | ||||||
|  |           onEdit: (entity) => _navigateToUpdateScreen(entity), | ||||||
|  |           onDelete: (entity) => _showDeleteDialog(entity), | ||||||
|  |           title: 'Basicp2', | ||||||
|  |           displayFields: [ | ||||||
|  |   {'key': 'about', 'label': 'about', 'type': 'textarea'}, | ||||||
|  | 
 | ||||||
|  |   {'key': 'textarea2', 'label': 'Textarea2', 'type': 'textarea'}, | ||||||
|  | 
 | ||||||
|  |   {'key': 'date_field', 'label': 'Date Field', 'type': 'date'}, | ||||||
|  | 
 | ||||||
|  |   {'key': 'date_field2', 'label': 'Date Field2', 'type': 'date'}, | ||||||
|  | 
 | ||||||
|  |   {'key': 'datetime_field', 'label': 'Datetime Field', 'type': 'datetime'}, | ||||||
|  | 
 | ||||||
|  |   {'key': 'datetime_field2', 'label': 'Datetime Field2', 'type': 'datetime'}, | ||||||
|  | 
 | ||||||
|  |   {'key': 'email_field', 'label': 'Email Field', 'type': 'email'}, | ||||||
|  | 
 | ||||||
|  |   {'key': 'email_field2', 'label': 'Email Field2', 'type': 'email'}, | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |           ], | ||||||
|  |           isLoading: viewModel.isLoading, | ||||||
|  |         ); | ||||||
|  |       }, | ||||||
|  |     ); | ||||||
|  |   } | ||||||
|  | } | ||||||
| @ -0,0 +1,162 @@ | |||||||
|  | // 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 'Basicp2_create_entity_screen.dart'; | ||||||
|  | import 'Basicp2_update_entity_screen.dart'; | ||||||
|  | import '../Basicp2_viewModel/Basicp2_view_model_screen.dart'; | ||||||
|  | import 'Basicp2_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 Basicp2_entity_list_screen extends StatefulWidget { | ||||||
|  |   static const String routeName = '/entity-list'; | ||||||
|  | 
 | ||||||
|  |   @override | ||||||
|  |   _Basicp2_entity_list_screenState createState() => _Basicp2_entity_list_screenState(); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | class _Basicp2_entity_list_screenState extends State<Basicp2_entity_list_screen> { | ||||||
|  |   @override | ||||||
|  |   void initState() { | ||||||
|  |     super.initState(); | ||||||
|  |     _loadData(); | ||||||
|  |   } | ||||||
|  | 
 | ||||||
|  |   void _loadData() { | ||||||
|  |     WidgetsBinding.instance.addPostFrameCallback((_) { | ||||||
|  |       if (mounted) { | ||||||
|  |         final vm = Provider.of<Basicp2ViewModelScreen>(context, listen: false); | ||||||
|  |         vm.getAllWithPagination(refresh: true); | ||||||
|  |       } | ||||||
|  |     }); | ||||||
|  |   } | ||||||
|  | 
 | ||||||
|  |   void _navigateToCreateScreen() { | ||||||
|  |     Navigator.push( | ||||||
|  |       context, | ||||||
|  |       MaterialPageRoute( | ||||||
|  |         builder: (context) => ChangeNotifierProvider( | ||||||
|  |           create: (context) => Basicp2ViewModelScreen(), | ||||||
|  |           child: const Basicp2CreateEntityScreen(), | ||||||
|  |         ), | ||||||
|  |       ), | ||||||
|  |     ).then((_) { | ||||||
|  |       final vm = Provider.of<Basicp2ViewModelScreen>(context, listen: false); | ||||||
|  |       vm.refreshData(); | ||||||
|  |     }); | ||||||
|  |   } | ||||||
|  | 
 | ||||||
|  |   void _navigateToUpdateScreen(Map<String, dynamic> entity) { | ||||||
|  |     Navigator.push( | ||||||
|  |       context, | ||||||
|  |       MaterialPageRoute( | ||||||
|  |         builder: (context) => ChangeNotifierProvider( | ||||||
|  |           create: (context) => Basicp2ViewModelScreen(), | ||||||
|  |           child: Basicp2UpdateEntityScreen(entity: entity), | ||||||
|  |         ), | ||||||
|  |       ), | ||||||
|  |     ).then((_) { | ||||||
|  |       final vm = Provider.of<Basicp2ViewModelScreen>(context, listen: false); | ||||||
|  |       vm.refreshData(); | ||||||
|  |     }); | ||||||
|  |   } | ||||||
|  | 
 | ||||||
|  |   void _navigateToDetailsScreen(Map<String, dynamic> entity) { | ||||||
|  |     Navigator.push( | ||||||
|  |       context, | ||||||
|  |       MaterialPageRoute( | ||||||
|  |         builder: (context) => ChangeNotifierProvider( | ||||||
|  |           create: (context) => Basicp2ViewModelScreen(), | ||||||
|  |           child: Basicp2DetailsScreen(entity: entity), | ||||||
|  |         ), | ||||||
|  |       ), | ||||||
|  |     ); | ||||||
|  |   } | ||||||
|  | 
 | ||||||
|  |   void _showDeleteDialog(Map<String, dynamic> 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 Basicp2?'), | ||||||
|  |           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<Basicp2ViewModelScreen>(parentContext, listen: false); | ||||||
|  |                 await vm.deleteEntity(entity['id']); | ||||||
|  |               }, | ||||||
|  |             ), | ||||||
|  |           ], | ||||||
|  |         ); | ||||||
|  |       }, | ||||||
|  |     ); | ||||||
|  |   } | ||||||
|  | 
 | ||||||
|  |   @override | ||||||
|  |   Widget build(BuildContext context) { | ||||||
|  |     return Consumer<Basicp2ViewModelScreen>( | ||||||
|  |       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.searchbasicp2(query), | ||||||
|  |           onEdit: (entity) => _navigateToUpdateScreen(entity), | ||||||
|  |           onDelete: (entity) => _showDeleteDialog(entity), | ||||||
|  |           onTap: (entity) => _navigateToDetailsScreen(entity), | ||||||
|  |           onRefresh: () => viewModel.refreshData(), | ||||||
|  |           onLoadMore: () => viewModel.getAllWithPagination(), | ||||||
|  |           title: 'Basicp2', | ||||||
|  |           onAddNew: _navigateToCreateScreen, | ||||||
|  |           displayFields: [ | ||||||
|  |   {'key': 'about', 'label': 'about', 'type': 'textarea'}, | ||||||
|  | 
 | ||||||
|  |   {'key': 'textarea2', 'label': 'Textarea2', 'type': 'textarea'}, | ||||||
|  | 
 | ||||||
|  |   {'key': 'date_field', 'label': 'Date Field', 'type': 'date'}, | ||||||
|  | 
 | ||||||
|  |   {'key': 'date_field2', 'label': 'Date Field2', 'type': 'date'}, | ||||||
|  | 
 | ||||||
|  |   {'key': 'datetime_field', 'label': 'Datetime Field', 'type': 'datetime'}, | ||||||
|  | 
 | ||||||
|  |   {'key': 'datetime_field2', 'label': 'Datetime Field2', 'type': 'datetime'}, | ||||||
|  | 
 | ||||||
|  |   {'key': 'email_field', 'label': 'Email Field', 'type': 'email'}, | ||||||
|  | 
 | ||||||
|  |   {'key': 'email_field2', 'label': 'Email Field2', 'type': 'email'}, | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |           ], | ||||||
|  |         ); | ||||||
|  |       }, | ||||||
|  |     ); | ||||||
|  |   } | ||||||
|  | } | ||||||
| @ -0,0 +1,116 @@ | |||||||
|  | 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 '../Basicp2_viewModel/Basicp2_view_model_screen.dart';/// Field definitions for Basicp2 entity | ||||||
|  | /// This defines the structure and validation for Basicp2 forms | ||||||
|  | class Basicp2Fields { | ||||||
|  |   /// Get field definitions for Basicp2 entity | ||||||
|  |   static List<BaseField> getFields(BuildContext context) { | ||||||
|  |     final viewModel = | ||||||
|  |         Provider.of<Basicp2ViewModelScreen>(context, listen: false); | ||||||
|  |     return [ | ||||||
|  |       // Basic Information | ||||||
|  | CustomTextField( | ||||||
|  |         fieldKey: 'about', | ||||||
|  |         label: 'about', | ||||||
|  |         hint: 'Enter about', | ||||||
|  |         isRequired: false, | ||||||
|  |         maxLength: 1000, | ||||||
|  |       ), | ||||||
|  | 
 | ||||||
|  | CustomTextField( | ||||||
|  |         fieldKey: 'textarea2', | ||||||
|  |         label: 'Textarea2', | ||||||
|  |         hint: 'Enter Textarea2', | ||||||
|  |         isRequired: false, | ||||||
|  |         maxLength: 1000, | ||||||
|  |       ), | ||||||
|  | 
 | ||||||
|  |  DateField( | ||||||
|  |         fieldKey: 'date_field', | ||||||
|  |         label: 'Date Field', | ||||||
|  |         hint: 'Select Date Field', | ||||||
|  |         isRequired: false, | ||||||
|  |       ), | ||||||
|  | 
 | ||||||
|  |  DateField( | ||||||
|  |         fieldKey: 'date_field2', | ||||||
|  |         label: 'Date Field2', | ||||||
|  |         hint: 'Select Date Field2', | ||||||
|  |         isRequired: false, | ||||||
|  |       ), | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | DateTimeField( | ||||||
|  |         fieldKey: 'datetime_field', | ||||||
|  |         label: 'Datetime Field', | ||||||
|  |         hint: 'Select Datetime Field', | ||||||
|  |         isRequired: false, | ||||||
|  |       ), | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | DateTimeField( | ||||||
|  |         fieldKey: 'datetime_field2', | ||||||
|  |         label: 'Datetime Field2', | ||||||
|  |         hint: 'Select Datetime Field2', | ||||||
|  |         isRequired: false, | ||||||
|  |       ), | ||||||
|  | 
 | ||||||
|  | EmailField( | ||||||
|  |         fieldKey: 'email_field', | ||||||
|  |         label: 'Email Field', | ||||||
|  |         hint: 'Enter Email Field', | ||||||
|  |         isRequired: false, | ||||||
|  |       ), | ||||||
|  | 
 | ||||||
|  | EmailField( | ||||||
|  |         fieldKey: 'email_field2', | ||||||
|  |         label: 'Email Field2', | ||||||
|  |         hint: 'Enter Email Field2', | ||||||
|  |         isRequired: false, | ||||||
|  |       ), | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |     ]; | ||||||
|  |   } | ||||||
|  | } | ||||||
| @ -0,0 +1,89 @@ | |||||||
|  | // ignore_for_file: use_build_context_synchronously | ||||||
|  | import 'dart:convert'; | ||||||
|  | import 'package:provider/provider.dart'; | ||||||
|  | import '../Basicp2_viewModel/Basicp2_view_model_screen.dart'; | ||||||
|  | import 'package:base_project/BuilderField/shared/ui/entity_screens.dart'; | ||||||
|  | import 'Basicp2_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 Basicp2UpdateEntityScreen extends StatefulWidget { | ||||||
|  |     final Map<String, dynamic> entity; | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |   Basicp2UpdateEntityScreen({required this.entity}); | ||||||
|  | 
 | ||||||
|  |   @override | ||||||
|  |   _Basicp2UpdateEntityScreenState createState() => _Basicp2UpdateEntityScreenState(); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | class _Basicp2UpdateEntityScreenState extends State<Basicp2UpdateEntityScreen> { | ||||||
|  |   final _formKey = GlobalKey<FormState>(); | ||||||
|  | 
 | ||||||
|  | @override | ||||||
|  |   Widget build(BuildContext context) { | ||||||
|  |     return Consumer<Basicp2ViewModelScreen>( | ||||||
|  |       builder: (context, viewModel, child) { | ||||||
|  | // Start with all fields, then remove upload fields (generic filter by keys) | ||||||
|  |         final Set<String> hiddenKeys = {  | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |  }; | ||||||
|  |         final fields = Basicp2Fields.getFields(context) | ||||||
|  |             .where((f) => !hiddenKeys.contains(f.fieldKey)) | ||||||
|  |             .toList();        return EntityUpdateScreen( | ||||||
|  |           fields: fields, | ||||||
|  |           initialData: widget.entity, | ||||||
|  |           onSubmit: (data) => _handleSubmit(data), | ||||||
|  |           title: 'Basicp2', | ||||||
|  |           isLoading: viewModel.isLoading, | ||||||
|  |           errorMessage: | ||||||
|  |               viewModel.errorMessage.isNotEmpty ? viewModel.errorMessage : null, | ||||||
|  |         ); | ||||||
|  |       }, | ||||||
|  |     ); | ||||||
|  |   } | ||||||
|  | 
 | ||||||
|  |   Future<void> _handleSubmit(Map<String, dynamic> formData) async { | ||||||
|  |     final provider = | ||||||
|  |         Provider.of<Basicp2ViewModelScreen>(context, listen: false); | ||||||
|  |     final success = await provider.updateEntity(widget.entity['id'], formData); | ||||||
|  | 
 | ||||||
|  |     if (success && mounted) { | ||||||
|  |       Navigator.pop(context); | ||||||
|  |     } | ||||||
|  |   } | ||||||
|  | } | ||||||
| @ -0,0 +1,107 @@ | |||||||
|  | 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 Basicp2RepoScreen { | ||||||
|  | 
 | ||||||
|  |   final String baseUrl = ApiConstants.baseUrl; | ||||||
|  |   final BaseNetworkService _helper = NetworkApiService(); | ||||||
|  |   final String _endpointPath = '/Basicp2/Basicp2'; | ||||||
|  | 
 | ||||||
|  |   Future<ApiResponse<List<Map<String, dynamic>>>> getEntities() async { | ||||||
|  |     try { | ||||||
|  |       final response = | ||||||
|  |           await _helper.getGetApiResponse('$baseUrl$_endpointPath'); | ||||||
|  |       print('Response received: $response'); | ||||||
|  |       List<Map<String, dynamic>> entities = const []; | ||||||
|  |       if (response is List) { | ||||||
|  |         entities = response | ||||||
|  |             .whereType<Map>() | ||||||
|  |             .map((e) => Map<String, dynamic>.from(e as Map)) | ||||||
|  |             .toList(); | ||||||
|  |       } else if (response is Map<String, dynamic>) { | ||||||
|  |         final dynamic content = response['content']; | ||||||
|  |         if (content is List) { | ||||||
|  |           entities = content | ||||||
|  |               .whereType<Map>() | ||||||
|  |               .map((e) => Map<String, dynamic>.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<ApiResponse<List<Map<String, dynamic>>>> getAllWithPagination( | ||||||
|  |       int page, int size) async { | ||||||
|  |     try { | ||||||
|  |       final response = await _helper.getGetApiResponse( | ||||||
|  |           '$baseUrl$_endpointPath/getall/page?page=$page&size=$size'); | ||||||
|  | 
 | ||||||
|  |       if (response is Map<String, dynamic> && response['content'] is List) { | ||||||
|  |         final List<Map<String, dynamic>> entities = | ||||||
|  |             (response['content'] as List).cast<Map<String, dynamic>>().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<ApiResponse<Map<String, dynamic>>> createEntity( | ||||||
|  |       Map<String, dynamic> entity) async { | ||||||
|  |     try { | ||||||
|  |       print("in post api$entity"); | ||||||
|  |       final response = | ||||||
|  |           await _helper.getPostApiResponse('$baseUrl$_endpointPath', entity); | ||||||
|  |       return ApiResponse.success(response as Map<String, dynamic>); | ||||||
|  |     } catch (e) { | ||||||
|  |       return ApiResponse.error('Failed to create entity: $e'); | ||||||
|  |     } | ||||||
|  |   } | ||||||
|  | 
 | ||||||
|  |   Future<ApiResponse<Map<String, dynamic>>> updateEntity( | ||||||
|  |       int entityId, Map<String, dynamic> entity) async { | ||||||
|  |     try { | ||||||
|  |       final response = await _helper.getPutApiResponse( | ||||||
|  |           '$baseUrl$_endpointPath/$entityId', entity); | ||||||
|  |       return ApiResponse.success(response as Map<String, dynamic>); | ||||||
|  |     } catch (e) { | ||||||
|  |       return ApiResponse.error('Failed to update entity: $e'); | ||||||
|  |     } | ||||||
|  |   } | ||||||
|  | 
 | ||||||
|  |   Future<ApiResponse<void>> 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'); | ||||||
|  |     } | ||||||
|  |   } | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | } | ||||||
| @ -0,0 +1,400 @@ | |||||||
|  | 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 '../Basicp2_Repo/Basicp2_repo_screen.dart'; | ||||||
|  | 
 | ||||||
|  | class Basicp2ViewModelScreen extends ChangeNotifier{ | ||||||
|  |   final Basicp2RepoScreen repo = Basicp2RepoScreen(); | ||||||
|  | 
 | ||||||
|  |   | ||||||
|  |   // State variables | ||||||
|  |   List<Map<String, dynamic>> _basicp2List = []; | ||||||
|  |   List<Map<String, dynamic>> _filteredList = []; | ||||||
|  |   bool _isLoading = false; | ||||||
|  |   String _errorMessage = ''; | ||||||
|  |   int _currentPage = 0; | ||||||
|  |   int _pageSize = 10; | ||||||
|  |   bool _hasMoreData = true; | ||||||
|  |   String _searchQuery = ''; | ||||||
|  | 
 | ||||||
|  |   // Getters | ||||||
|  |   List<Map<String, dynamic>> get basicp2List => _basicp2List; | ||||||
|  |   List<Map<String, dynamic>> 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 basicp2 list | ||||||
|  |   Future<void> getEntities() async { | ||||||
|  |     _setLoading(true); | ||||||
|  |     _setError(''); | ||||||
|  | 
 | ||||||
|  |     try { | ||||||
|  |       final response = await repo.getEntities(); | ||||||
|  | 
 | ||||||
|  |       if (response.status == Status.SUCCESS) { | ||||||
|  |         _basicp2List = response.data ?? []; | ||||||
|  |         _filteredList = List.from(_basicp2List); | ||||||
|  |         _currentPage = 0; | ||||||
|  |         _hasMoreData = true; | ||||||
|  |       } else { | ||||||
|  |         _setError(response.message ?? 'Failed to fetch basicp2 list'); | ||||||
|  |       } | ||||||
|  |     } catch (e) { | ||||||
|  |       _setError('Failed to fetch basicp2 list: $e'); | ||||||
|  |     } finally { | ||||||
|  |       _setLoading(false); | ||||||
|  |     } | ||||||
|  |   } | ||||||
|  | 
 | ||||||
|  |   // Get basicp2 list with pagination | ||||||
|  |   Future<void> getAllWithPagination({bool refresh = false}) async { | ||||||
|  |     if (refresh) { | ||||||
|  |       _currentPage = 0; | ||||||
|  |       _basicp2List.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) { | ||||||
|  |           _basicp2List = newItems; | ||||||
|  |         } else { | ||||||
|  |           _basicp2List.addAll(newItems); | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |         _filteredList = List.from(_basicp2List); | ||||||
|  |         _currentPage++; | ||||||
|  | 
 | ||||||
|  |         // Check if we have more data | ||||||
|  |         _hasMoreData = newItems.length == _pageSize; | ||||||
|  |       } else { | ||||||
|  |         _setError(response.message ?? 'Failed to fetch Basicp2 list'); | ||||||
|  |       } | ||||||
|  |     } catch (e) { | ||||||
|  |       _setError('Failed to fetch basicp2 list: $e'); | ||||||
|  |     } finally { | ||||||
|  |       _setLoading(false); | ||||||
|  |     } | ||||||
|  |   } | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |   // Create Basicp2 | ||||||
|  |   Future<bool> createEntity(Map<String, dynamic> 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: 'basicp2 created successfully', | ||||||
|  |           toastType: ToastType.success, | ||||||
|  |         ); | ||||||
|  | 
 | ||||||
|  |         // Refresh the list | ||||||
|  |         await getEntities(); | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |         return true; | ||||||
|  |       } else { | ||||||
|  |         _setError(response.message ?? 'Failed to create Basicp2'); | ||||||
|  |         ToastMessageUtil.showToast( | ||||||
|  |           message: response.message ?? 'Failed to create Basicp2', | ||||||
|  |           toastType: ToastType.error, | ||||||
|  |         ); | ||||||
|  |         return false; | ||||||
|  |       } | ||||||
|  |     } catch (e) { | ||||||
|  |       _setError('Failed to create basicp2: $e'); | ||||||
|  |       ToastMessageUtil.showToast( | ||||||
|  |         message: 'Failed to create Basicp2: $e', | ||||||
|  |         toastType: ToastType.error, | ||||||
|  |       ); | ||||||
|  |       return false; | ||||||
|  |     } finally { | ||||||
|  |       _setLoading(false); | ||||||
|  |     } | ||||||
|  |   } | ||||||
|  | 
 | ||||||
|  |   // Update basicp2 | ||||||
|  |   Future<bool> updateEntity(int id, Map<String, dynamic> entity) async { | ||||||
|  |     _setLoading(true); | ||||||
|  |     _setError(''); | ||||||
|  | 
 | ||||||
|  |     try { | ||||||
|  |       final response = await repo.updateEntity(id, entity); | ||||||
|  | 
 | ||||||
|  |       if (response.status == Status.SUCCESS) { | ||||||
|  |         ToastMessageUtil.showToast( | ||||||
|  |           message: 'Basicp2 updated successfully', | ||||||
|  |           toastType: ToastType.success, | ||||||
|  |         ); | ||||||
|  | 
 | ||||||
|  |         // Update the item in the list | ||||||
|  |         final index = _basicp2List.indexWhere((item) => item['id'] == id); | ||||||
|  |         if (index != -1) { | ||||||
|  |           _basicp2List[index] = response.data!; | ||||||
|  |           _filteredList = List.from(_basicp2List); | ||||||
|  |           notifyListeners(); | ||||||
|  |         } | ||||||
|  |         return true; | ||||||
|  |       } else { | ||||||
|  |         _setError(response.message ?? 'Failed to update Basicp2'); | ||||||
|  |         ToastMessageUtil.showToast( | ||||||
|  |           message: response.message ?? 'Failed to update Basicp2', | ||||||
|  |           toastType: ToastType.error, | ||||||
|  |         ); | ||||||
|  |         return false; | ||||||
|  |       } | ||||||
|  |     } catch (e) { | ||||||
|  |       _setError('Failed to update basicp2: $e'); | ||||||
|  |       ToastMessageUtil.showToast( | ||||||
|  |         message: 'Failed to update Basicp2: $e', | ||||||
|  |         toastType: ToastType.error, | ||||||
|  |       ); | ||||||
|  |       return false; | ||||||
|  |     } finally { | ||||||
|  |       _setLoading(false); | ||||||
|  |     } | ||||||
|  |   } | ||||||
|  | 
 | ||||||
|  |   // Delete basicp2 | ||||||
|  |   Future<bool> deleteEntity(int id) async { | ||||||
|  |     _setLoading(true); | ||||||
|  |     _setError(''); | ||||||
|  | 
 | ||||||
|  |     try { | ||||||
|  |       final response = await repo.deleteEntity(id); | ||||||
|  | 
 | ||||||
|  |       if (response.status == Status.SUCCESS) { | ||||||
|  |         ToastMessageUtil.showToast( | ||||||
|  |           message: 'Basicp2 deleted successfully', | ||||||
|  |           toastType: ToastType.success, | ||||||
|  |         ); | ||||||
|  | 
 | ||||||
|  |         // Remove the item from the list | ||||||
|  |         _basicp2List.removeWhere((item) => item['id'] == id); | ||||||
|  |         _filteredList = List.from(_basicp2List); | ||||||
|  |         notifyListeners(); | ||||||
|  |         return true; | ||||||
|  |       } else { | ||||||
|  |         _setError(response.message ?? 'Failed to delete Basicp2'); | ||||||
|  |         ToastMessageUtil.showToast( | ||||||
|  |           message: response.message ?? 'Failed to delete Basicp2', | ||||||
|  |           toastType: ToastType.error, | ||||||
|  |         ); | ||||||
|  |         return false; | ||||||
|  |       } | ||||||
|  |     } catch (e) { | ||||||
|  |       _setError('Failed to delete basicp2: $e'); | ||||||
|  |       ToastMessageUtil.showToast( | ||||||
|  |         message: 'Failed to delete Basicp2: $e', | ||||||
|  |         toastType: ToastType.error, | ||||||
|  |       ); | ||||||
|  |       return false; | ||||||
|  |     } finally { | ||||||
|  |       _setLoading(false); | ||||||
|  |     } | ||||||
|  |   } | ||||||
|  | 
 | ||||||
|  |   // Search basicp2 | ||||||
|  |   void searchbasicp2(String query) { | ||||||
|  |     _searchQuery = query; | ||||||
|  | 
 | ||||||
|  |     if (query.isEmpty) { | ||||||
|  |       _filteredList = List.from(_basicp2List); | ||||||
|  |     } else { | ||||||
|  |       _filteredList = _basicp2List.where((item) { | ||||||
|  |         return | ||||||
|  | 
 | ||||||
|  |               | ||||||
|  | (item['about']?.toString().toLowerCase().contains(query.toLowerCase()) ??false) || | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |               | ||||||
|  | (item['textarea2']?.toString().toLowerCase().contains(query.toLowerCase()) ??false) || | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |               | ||||||
|  | (item['date_field']?.toString().toLowerCase().contains(query.toLowerCase()) ??false) || | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |               | ||||||
|  | (item['date_field2']?.toString().toLowerCase().contains(query.toLowerCase()) ??false) || | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |               | ||||||
|  | (item['datetime_field']?.toString().toLowerCase().contains(query.toLowerCase()) ??false) || | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |               | ||||||
|  | (item['datetime_field2']?.toString().toLowerCase().contains(query.toLowerCase()) ??false) || | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |               | ||||||
|  | (item['email_field']?.toString().toLowerCase().contains(query.toLowerCase()) ??false) || | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |               | ||||||
|  | (item['email_field2']?.toString().toLowerCase().contains(query.toLowerCase()) ??false)  | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | ; | ||||||
|  |       }).toList(); | ||||||
|  |     } | ||||||
|  |     notifyListeners(); | ||||||
|  |   } | ||||||
|  | 
 | ||||||
|  |   // Clear search | ||||||
|  |   void clearSearch() { | ||||||
|  |     _searchQuery = ''; | ||||||
|  |     _filteredList = List.from(_basicp2List); | ||||||
|  |     notifyListeners(); | ||||||
|  |   } | ||||||
|  | 
 | ||||||
|  |   // Refresh data | ||||||
|  |   Future<void> refreshData() async { | ||||||
|  |     await getAllWithPagination(refresh: true); | ||||||
|  |   } | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | } | ||||||
| @ -0,0 +1,116 @@ | |||||||
|  | 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 Basicp3ApiService { | ||||||
|  |   final String baseUrl = ApiConstants.baseUrl; | ||||||
|  | 
 | ||||||
|  |       final BaseNetworkService _helper = NetworkApiService(); | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |    Future<List<Map<String, dynamic>>> getEntities() async { | ||||||
|  | 
 | ||||||
|  |     try { | ||||||
|  |       final response = await _helper.getGetApiResponse('$baseUrl/Basicp3/Basicp3'); | ||||||
|  |       final entities = (response as List).cast<Map<String, dynamic>>(); | ||||||
|  |       return entities; | ||||||
|  |     } catch (e) { | ||||||
|  |       throw Exception('Failed to get all entities: $e'); | ||||||
|  |     } | ||||||
|  |   } | ||||||
|  | Future<List<Map<String, dynamic>>> getAllWithPagination( | ||||||
|  |        int page, int size) async { | ||||||
|  |     try { | ||||||
|  |             final response = | ||||||
|  |           await _helper.getGetApiResponse('$baseUrl/Basicp3/Basicp3/getall/page?page=$page&size=$size'); | ||||||
|  |       final entities = | ||||||
|  |           (response['content'] as List).cast<Map<String, dynamic>>(); | ||||||
|  |       return entities; | ||||||
|  |     } catch (e) { | ||||||
|  |       throw Exception('Failed to get all without pagination: $e'); | ||||||
|  |     } | ||||||
|  |   } | ||||||
|  |   Future<Map<String, dynamic>> createEntity( | ||||||
|  |        Map<String, dynamic> entity) async { | ||||||
|  |     try { | ||||||
|  |             print("in post api$entity"); | ||||||
|  |       final response = | ||||||
|  |           await _helper.getPostApiResponse('$baseUrl/Basicp3/Basicp3', entity); | ||||||
|  | 
 | ||||||
|  |       print(entity); | ||||||
|  | 
 | ||||||
|  |       // Assuming the response is a Map<String, dynamic> | ||||||
|  |       Map<String, dynamic> responseData = response; | ||||||
|  | 
 | ||||||
|  |       return responseData; | ||||||
|  |     } catch (e) { | ||||||
|  |       throw Exception('Failed to create entity: $e'); | ||||||
|  |     } | ||||||
|  |   } | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |   Future<void> updateEntity( int entityId, Map<String, dynamic> entity) async { | ||||||
|  |     try { | ||||||
|  |      await _helper.getPutApiResponse('$baseUrl/Basicp3/Basicp3/$entityId', | ||||||
|  |       entity);                print(entity); | ||||||
|  | 
 | ||||||
|  |     } catch (e) { | ||||||
|  |       throw Exception('Failed to update entity: $e'); | ||||||
|  |     } | ||||||
|  |   } | ||||||
|  | 
 | ||||||
|  |   Future<void> deleteEntity( int entityId) async { | ||||||
|  |     try { | ||||||
|  |  await _helper.getDeleteApiResponse('$baseUrl/Basicp3/Basicp3/$entityId'); | ||||||
|  |     } catch (e) { | ||||||
|  |       throw Exception('Failed to delete entity: $e'); | ||||||
|  |     } | ||||||
|  |   } | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | } | ||||||
| @ -0,0 +1,98 @@ | |||||||
|  | // 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 '../Basicp3_viewModel/Basicp3_view_model_screen.dart'; | ||||||
|  | import 'Basicp3_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 Basicp3CreateEntityScreen extends StatefulWidget { | ||||||
|  |   const Basicp3CreateEntityScreen({super.key}); | ||||||
|  | 
 | ||||||
|  |   @override | ||||||
|  |   _Basicp3CreateEntityScreenState createState() => _Basicp3CreateEntityScreenState(); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | class _Basicp3CreateEntityScreenState extends State<Basicp3CreateEntityScreen> { | ||||||
|  | 
 | ||||||
|  | final Map<String, dynamic> formData = {}; | ||||||
|  |   final _formKey = GlobalKey<FormState>(); | ||||||
|  |    | ||||||
|  |   @override | ||||||
|  |   Widget build(BuildContext context) { | ||||||
|  |     return Consumer<Basicp3ViewModelScreen>( | ||||||
|  |       builder: (context, viewModel, child) { | ||||||
|  |         return EntityCreateScreen( | ||||||
|  |           fields: Basicp3Fields.getFields(context), | ||||||
|  |           onSubmit: (data) => _handleSubmit(data), | ||||||
|  |           title: 'Basicp3', | ||||||
|  |           isLoading: viewModel.isLoading, | ||||||
|  |           errorMessage: | ||||||
|  |               viewModel.errorMessage.isNotEmpty ? viewModel.errorMessage : null, | ||||||
|  |         ); | ||||||
|  |       }, | ||||||
|  |     ); | ||||||
|  |   } | ||||||
|  | 
 | ||||||
|  |   Future<void> _handleSubmit(Map<String, dynamic> formData) async { | ||||||
|  |     final provider = | ||||||
|  |         Provider.of<Basicp3ViewModelScreen>(context, listen: false); | ||||||
|  |     final success = await provider.createEntity(formData); | ||||||
|  | 
 | ||||||
|  |     if (success && mounted) { | ||||||
|  |       Navigator.pop(context); | ||||||
|  |     } | ||||||
|  |   } | ||||||
|  | } | ||||||
| @ -0,0 +1,106 @@ | |||||||
|  | // 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 '../Basicp3_viewModel/Basicp3_view_model_screen.dart'; | ||||||
|  | import 'Basicp3_update_entity_screen.dart'; | ||||||
|  | 
 | ||||||
|  | class Basicp3DetailsScreen extends StatefulWidget { | ||||||
|  |   final Map<String, dynamic> entity; | ||||||
|  | 
 | ||||||
|  |   const Basicp3DetailsScreen({ | ||||||
|  |     super.key, | ||||||
|  |     required this.entity, | ||||||
|  |   }); | ||||||
|  | 
 | ||||||
|  |   @override | ||||||
|  |   State<Basicp3DetailsScreen> createState() => _Basicp3DetailsScreenState(); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | class _Basicp3DetailsScreenState extends State<Basicp3DetailsScreen> { | ||||||
|  |   void _navigateToUpdateScreen(Map<String, dynamic> entity) { | ||||||
|  |     Navigator.push( | ||||||
|  |       context, | ||||||
|  |       MaterialPageRoute( | ||||||
|  |         builder: (context) => ChangeNotifierProvider( | ||||||
|  |           create: (context) => Basicp3ViewModelScreen(), | ||||||
|  |           child: Basicp3UpdateEntityScreen(entity: entity), | ||||||
|  |         ), | ||||||
|  |       ), | ||||||
|  |     ).then((_) { | ||||||
|  |       // Refresh the details screen with updated data | ||||||
|  |       setState(() {}); | ||||||
|  |     }); | ||||||
|  |   } | ||||||
|  | 
 | ||||||
|  |   void _showDeleteDialog(Map<String, dynamic> 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 Basicp3?'), | ||||||
|  |           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<Basicp3ViewModelScreen>(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<Basicp3ViewModelScreen>( | ||||||
|  |       builder: (context, viewModel, child) { | ||||||
|  |         return EntityDetails( | ||||||
|  |           entity: widget.entity, | ||||||
|  |           onEdit: (entity) => _navigateToUpdateScreen(entity), | ||||||
|  |           onDelete: (entity) => _showDeleteDialog(entity), | ||||||
|  |           title: 'Basicp3', | ||||||
|  |           displayFields: [ | ||||||
|  |   {'key': 'toggle_switch', 'label': 'Toggle Switch', 'type': 'toggle_switch'}, | ||||||
|  | 
 | ||||||
|  |   {'key': 'toggle_switch2', 'label': 'Toggle Switch2', 'type': 'toggle_switch'}, | ||||||
|  | 
 | ||||||
|  |   {'key': 'url_field', 'label': 'Url Field', 'type': 'url'}, | ||||||
|  | 
 | ||||||
|  |   {'key': 'url_field2', 'label': 'Url Field2', 'type': 'url'}, | ||||||
|  | 
 | ||||||
|  |   {'key': 'decimal_field', 'label': 'Decimal Field', 'type': 'decimal'}, | ||||||
|  | 
 | ||||||
|  |   {'key': 'decimal_field2', 'label': 'Decimal Field2', 'type': 'decimal'}, | ||||||
|  | 
 | ||||||
|  |   {'key': 'percentage_field', 'label': 'Percentage Field', 'type': 'number'}, | ||||||
|  | 
 | ||||||
|  |   {'key': 'percentage_field2', 'label': 'Percentage Field2', 'type': 'number'}, | ||||||
|  | 
 | ||||||
|  |   {'key': 'documentsequenc', 'label': 'documentsequenc', 'type': 'document_sequence'}, | ||||||
|  | 
 | ||||||
|  |   {'key': 'recaptcha', 'label': 'recaptcha', 'type': 'recaptcha'}, | ||||||
|  | 
 | ||||||
|  |   {'key': 'recaptcha2', 'label': 'recaptcha2', 'type': 'recaptcha'}, | ||||||
|  | 
 | ||||||
|  |           ], | ||||||
|  |           isLoading: viewModel.isLoading, | ||||||
|  |         ); | ||||||
|  |       }, | ||||||
|  |     ); | ||||||
|  |   } | ||||||
|  | } | ||||||
| @ -0,0 +1,166 @@ | |||||||
|  | // 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 'Basicp3_create_entity_screen.dart'; | ||||||
|  | import 'Basicp3_update_entity_screen.dart'; | ||||||
|  | import '../Basicp3_viewModel/Basicp3_view_model_screen.dart'; | ||||||
|  | import 'Basicp3_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 Basicp3_entity_list_screen extends StatefulWidget { | ||||||
|  |   static const String routeName = '/entity-list'; | ||||||
|  | 
 | ||||||
|  |   @override | ||||||
|  |   _Basicp3_entity_list_screenState createState() => _Basicp3_entity_list_screenState(); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | class _Basicp3_entity_list_screenState extends State<Basicp3_entity_list_screen> { | ||||||
|  |   @override | ||||||
|  |   void initState() { | ||||||
|  |     super.initState(); | ||||||
|  |     _loadData(); | ||||||
|  |   } | ||||||
|  | 
 | ||||||
|  |   void _loadData() { | ||||||
|  |     WidgetsBinding.instance.addPostFrameCallback((_) { | ||||||
|  |       if (mounted) { | ||||||
|  |         final vm = Provider.of<Basicp3ViewModelScreen>(context, listen: false); | ||||||
|  |         vm.getAllWithPagination(refresh: true); | ||||||
|  |       } | ||||||
|  |     }); | ||||||
|  |   } | ||||||
|  | 
 | ||||||
|  |   void _navigateToCreateScreen() { | ||||||
|  |     Navigator.push( | ||||||
|  |       context, | ||||||
|  |       MaterialPageRoute( | ||||||
|  |         builder: (context) => ChangeNotifierProvider( | ||||||
|  |           create: (context) => Basicp3ViewModelScreen(), | ||||||
|  |           child: const Basicp3CreateEntityScreen(), | ||||||
|  |         ), | ||||||
|  |       ), | ||||||
|  |     ).then((_) { | ||||||
|  |       final vm = Provider.of<Basicp3ViewModelScreen>(context, listen: false); | ||||||
|  |       vm.refreshData(); | ||||||
|  |     }); | ||||||
|  |   } | ||||||
|  | 
 | ||||||
|  |   void _navigateToUpdateScreen(Map<String, dynamic> entity) { | ||||||
|  |     Navigator.push( | ||||||
|  |       context, | ||||||
|  |       MaterialPageRoute( | ||||||
|  |         builder: (context) => ChangeNotifierProvider( | ||||||
|  |           create: (context) => Basicp3ViewModelScreen(), | ||||||
|  |           child: Basicp3UpdateEntityScreen(entity: entity), | ||||||
|  |         ), | ||||||
|  |       ), | ||||||
|  |     ).then((_) { | ||||||
|  |       final vm = Provider.of<Basicp3ViewModelScreen>(context, listen: false); | ||||||
|  |       vm.refreshData(); | ||||||
|  |     }); | ||||||
|  |   } | ||||||
|  | 
 | ||||||
|  |   void _navigateToDetailsScreen(Map<String, dynamic> entity) { | ||||||
|  |     Navigator.push( | ||||||
|  |       context, | ||||||
|  |       MaterialPageRoute( | ||||||
|  |         builder: (context) => ChangeNotifierProvider( | ||||||
|  |           create: (context) => Basicp3ViewModelScreen(), | ||||||
|  |           child: Basicp3DetailsScreen(entity: entity), | ||||||
|  |         ), | ||||||
|  |       ), | ||||||
|  |     ); | ||||||
|  |   } | ||||||
|  | 
 | ||||||
|  |   void _showDeleteDialog(Map<String, dynamic> 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 Basicp3?'), | ||||||
|  |           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<Basicp3ViewModelScreen>(parentContext, listen: false); | ||||||
|  |                 await vm.deleteEntity(entity['id']); | ||||||
|  |               }, | ||||||
|  |             ), | ||||||
|  |           ], | ||||||
|  |         ); | ||||||
|  |       }, | ||||||
|  |     ); | ||||||
|  |   } | ||||||
|  | 
 | ||||||
|  |   @override | ||||||
|  |   Widget build(BuildContext context) { | ||||||
|  |     return Consumer<Basicp3ViewModelScreen>( | ||||||
|  |       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.searchbasicp3(query), | ||||||
|  |           onEdit: (entity) => _navigateToUpdateScreen(entity), | ||||||
|  |           onDelete: (entity) => _showDeleteDialog(entity), | ||||||
|  |           onTap: (entity) => _navigateToDetailsScreen(entity), | ||||||
|  |           onRefresh: () => viewModel.refreshData(), | ||||||
|  |           onLoadMore: () => viewModel.getAllWithPagination(), | ||||||
|  |           title: 'Basicp3', | ||||||
|  |           onAddNew: _navigateToCreateScreen, | ||||||
|  |           displayFields: [ | ||||||
|  |   {'key': 'toggle_switch', 'label': 'Toggle Switch', 'type': 'toggle_switch'}, | ||||||
|  | 
 | ||||||
|  |   {'key': 'toggle_switch2', 'label': 'Toggle Switch2', 'type': 'toggle_switch'}, | ||||||
|  | 
 | ||||||
|  |   {'key': 'url_field', 'label': 'Url Field', 'type': 'url'}, | ||||||
|  | 
 | ||||||
|  |   {'key': 'url_field2', 'label': 'Url Field2', 'type': 'url'}, | ||||||
|  | 
 | ||||||
|  |   {'key': 'decimal_field', 'label': 'Decimal Field', 'type': 'decimal'}, | ||||||
|  | 
 | ||||||
|  |   {'key': 'decimal_field2', 'label': 'Decimal Field2', 'type': 'decimal'}, | ||||||
|  | 
 | ||||||
|  |   {'key': 'percentage_field', 'label': 'Percentage Field', 'type': 'number'}, | ||||||
|  | 
 | ||||||
|  |   {'key': 'percentage_field2', 'label': 'Percentage Field2', 'type': 'number'}, | ||||||
|  | 
 | ||||||
|  |   {'key': 'documentsequenc', 'label': 'documentsequenc', 'type': 'document_sequence'}, | ||||||
|  | 
 | ||||||
|  |   {'key': 'recaptcha', 'label': 'recaptcha', 'type': 'recaptcha'}, | ||||||
|  | 
 | ||||||
|  |   {'key': 'recaptcha2', 'label': 'recaptcha2', 'type': 'recaptcha'}, | ||||||
|  | 
 | ||||||
|  |           ], | ||||||
|  |         ); | ||||||
|  |       }, | ||||||
|  |     ); | ||||||
|  |   } | ||||||
|  | } | ||||||
| @ -0,0 +1,130 @@ | |||||||
|  | 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 '../Basicp3_viewModel/Basicp3_view_model_screen.dart';/// Field definitions for Basicp3 entity | ||||||
|  | /// This defines the structure and validation for Basicp3 forms | ||||||
|  | class Basicp3Fields { | ||||||
|  |   /// Get field definitions for Basicp3 entity | ||||||
|  |   static List<BaseField> getFields(BuildContext context) { | ||||||
|  |     final viewModel = | ||||||
|  |         Provider.of<Basicp3ViewModelScreen>(context, listen: false); | ||||||
|  |     return [ | ||||||
|  |       // Basic Information | ||||||
|  |  SwitchField( | ||||||
|  |         fieldKey: 'toggle_switch', | ||||||
|  |         label: 'Toggle Switch', | ||||||
|  |       ), | ||||||
|  | 
 | ||||||
|  |  SwitchField( | ||||||
|  |         fieldKey: 'toggle_switch2', | ||||||
|  |         label: 'Toggle Switch2', | ||||||
|  |       ), | ||||||
|  | 
 | ||||||
|  |  UrlField( | ||||||
|  |         fieldKey: 'url_field', | ||||||
|  |         label: 'Url Field', | ||||||
|  |         hint: 'Enter Url Field', | ||||||
|  |       ), | ||||||
|  | 
 | ||||||
|  |  UrlField( | ||||||
|  |         fieldKey: 'url_field2', | ||||||
|  |         label: 'Url Field2', | ||||||
|  |         hint: 'Enter Url Field2', | ||||||
|  |       ), | ||||||
|  | 
 | ||||||
|  |  NumberField( | ||||||
|  |         fieldKey: 'decimal_field', | ||||||
|  |         label: 'Decimal Field', | ||||||
|  |         hint: '0.00', | ||||||
|  |         isRequired: false, | ||||||
|  |         decimalPlaces: 2, | ||||||
|  |       ), | ||||||
|  | 
 | ||||||
|  |  NumberField( | ||||||
|  |         fieldKey: 'decimal_field2', | ||||||
|  |         label: 'Decimal Field2', | ||||||
|  |         hint: '0.00', | ||||||
|  |         isRequired: false, | ||||||
|  |         decimalPlaces: 2, | ||||||
|  |       ), | ||||||
|  | 
 | ||||||
|  |   // Number Fields | ||||||
|  |       NumberField( | ||||||
|  |         fieldKey: 'percentage_field', | ||||||
|  |         label: 'Percentage Field', | ||||||
|  |         hint: 'Enter Percentage Field', | ||||||
|  |         isRequired: false, | ||||||
|  |         min: 0, | ||||||
|  |         decimalPlaces: 0, | ||||||
|  |       ), | ||||||
|  | 
 | ||||||
|  |   // Number Fields | ||||||
|  |       NumberField( | ||||||
|  |         fieldKey: 'percentage_field2', | ||||||
|  |         label: 'Percentage Field2', | ||||||
|  |         hint: 'Enter Percentage Field2', | ||||||
|  |         isRequired: false, | ||||||
|  |         min: 0, | ||||||
|  |         decimalPlaces: 0, | ||||||
|  |       ), | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |  CaptchaField( | ||||||
|  |         fieldKey: 'recaptcha', | ||||||
|  |         label: 'recaptcha', | ||||||
|  |         length: 6, | ||||||
|  |       ), | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |  CaptchaField( | ||||||
|  |         fieldKey: 'recaptcha2', | ||||||
|  |         label: 'recaptcha2', | ||||||
|  |         length: 6, | ||||||
|  |       ), | ||||||
|  | 
 | ||||||
|  |     ]; | ||||||
|  |   } | ||||||
|  | } | ||||||
| @ -0,0 +1,93 @@ | |||||||
|  | // ignore_for_file: use_build_context_synchronously | ||||||
|  | import 'dart:convert'; | ||||||
|  | import 'package:provider/provider.dart'; | ||||||
|  | import '../Basicp3_viewModel/Basicp3_view_model_screen.dart'; | ||||||
|  | import 'package:base_project/BuilderField/shared/ui/entity_screens.dart'; | ||||||
|  | import 'Basicp3_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 Basicp3UpdateEntityScreen extends StatefulWidget { | ||||||
|  |     final Map<String, dynamic> entity; | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |   Basicp3UpdateEntityScreen({required this.entity}); | ||||||
|  | 
 | ||||||
|  |   @override | ||||||
|  |   _Basicp3UpdateEntityScreenState createState() => _Basicp3UpdateEntityScreenState(); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | class _Basicp3UpdateEntityScreenState extends State<Basicp3UpdateEntityScreen> { | ||||||
|  |   final _formKey = GlobalKey<FormState>(); | ||||||
|  | 
 | ||||||
|  | @override | ||||||
|  |   Widget build(BuildContext context) { | ||||||
|  |     return Consumer<Basicp3ViewModelScreen>( | ||||||
|  |       builder: (context, viewModel, child) { | ||||||
|  | // Start with all fields, then remove upload fields (generic filter by keys) | ||||||
|  |         final Set<String> hiddenKeys = {  | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |  }; | ||||||
|  |         final fields = Basicp3Fields.getFields(context) | ||||||
|  |             .where((f) => !hiddenKeys.contains(f.fieldKey)) | ||||||
|  |             .toList();        return EntityUpdateScreen( | ||||||
|  |           fields: fields, | ||||||
|  |           initialData: widget.entity, | ||||||
|  |           onSubmit: (data) => _handleSubmit(data), | ||||||
|  |           title: 'Basicp3', | ||||||
|  |           isLoading: viewModel.isLoading, | ||||||
|  |           errorMessage: | ||||||
|  |               viewModel.errorMessage.isNotEmpty ? viewModel.errorMessage : null, | ||||||
|  |         ); | ||||||
|  |       }, | ||||||
|  |     ); | ||||||
|  |   } | ||||||
|  | 
 | ||||||
|  |   Future<void> _handleSubmit(Map<String, dynamic> formData) async { | ||||||
|  |     final provider = | ||||||
|  |         Provider.of<Basicp3ViewModelScreen>(context, listen: false); | ||||||
|  |     final success = await provider.updateEntity(widget.entity['id'], formData); | ||||||
|  | 
 | ||||||
|  |     if (success && mounted) { | ||||||
|  |       Navigator.pop(context); | ||||||
|  |     } | ||||||
|  |   } | ||||||
|  | } | ||||||
| @ -0,0 +1,111 @@ | |||||||
|  | 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 Basicp3RepoScreen { | ||||||
|  | 
 | ||||||
|  |   final String baseUrl = ApiConstants.baseUrl; | ||||||
|  |   final BaseNetworkService _helper = NetworkApiService(); | ||||||
|  |   final String _endpointPath = '/Basicp3/Basicp3'; | ||||||
|  | 
 | ||||||
|  |   Future<ApiResponse<List<Map<String, dynamic>>>> getEntities() async { | ||||||
|  |     try { | ||||||
|  |       final response = | ||||||
|  |           await _helper.getGetApiResponse('$baseUrl$_endpointPath'); | ||||||
|  |       print('Response received: $response'); | ||||||
|  |       List<Map<String, dynamic>> entities = const []; | ||||||
|  |       if (response is List) { | ||||||
|  |         entities = response | ||||||
|  |             .whereType<Map>() | ||||||
|  |             .map((e) => Map<String, dynamic>.from(e as Map)) | ||||||
|  |             .toList(); | ||||||
|  |       } else if (response is Map<String, dynamic>) { | ||||||
|  |         final dynamic content = response['content']; | ||||||
|  |         if (content is List) { | ||||||
|  |           entities = content | ||||||
|  |               .whereType<Map>() | ||||||
|  |               .map((e) => Map<String, dynamic>.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<ApiResponse<List<Map<String, dynamic>>>> getAllWithPagination( | ||||||
|  |       int page, int size) async { | ||||||
|  |     try { | ||||||
|  |       final response = await _helper.getGetApiResponse( | ||||||
|  |           '$baseUrl$_endpointPath/getall/page?page=$page&size=$size'); | ||||||
|  | 
 | ||||||
|  |       if (response is Map<String, dynamic> && response['content'] is List) { | ||||||
|  |         final List<Map<String, dynamic>> entities = | ||||||
|  |             (response['content'] as List).cast<Map<String, dynamic>>().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<ApiResponse<Map<String, dynamic>>> createEntity( | ||||||
|  |       Map<String, dynamic> entity) async { | ||||||
|  |     try { | ||||||
|  |       print("in post api$entity"); | ||||||
|  |       final response = | ||||||
|  |           await _helper.getPostApiResponse('$baseUrl$_endpointPath', entity); | ||||||
|  |       return ApiResponse.success(response as Map<String, dynamic>); | ||||||
|  |     } catch (e) { | ||||||
|  |       return ApiResponse.error('Failed to create entity: $e'); | ||||||
|  |     } | ||||||
|  |   } | ||||||
|  | 
 | ||||||
|  |   Future<ApiResponse<Map<String, dynamic>>> updateEntity( | ||||||
|  |       int entityId, Map<String, dynamic> entity) async { | ||||||
|  |     try { | ||||||
|  |       final response = await _helper.getPutApiResponse( | ||||||
|  |           '$baseUrl$_endpointPath/$entityId', entity); | ||||||
|  |       return ApiResponse.success(response as Map<String, dynamic>); | ||||||
|  |     } catch (e) { | ||||||
|  |       return ApiResponse.error('Failed to update entity: $e'); | ||||||
|  |     } | ||||||
|  |   } | ||||||
|  | 
 | ||||||
|  |   Future<ApiResponse<void>> 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'); | ||||||
|  |     } | ||||||
|  |   } | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | } | ||||||
| @ -0,0 +1,422 @@ | |||||||
|  | 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 '../Basicp3_Repo/Basicp3_repo_screen.dart'; | ||||||
|  | 
 | ||||||
|  | class Basicp3ViewModelScreen extends ChangeNotifier{ | ||||||
|  |   final Basicp3RepoScreen repo = Basicp3RepoScreen(); | ||||||
|  | 
 | ||||||
|  |   | ||||||
|  |   // State variables | ||||||
|  |   List<Map<String, dynamic>> _basicp3List = []; | ||||||
|  |   List<Map<String, dynamic>> _filteredList = []; | ||||||
|  |   bool _isLoading = false; | ||||||
|  |   String _errorMessage = ''; | ||||||
|  |   int _currentPage = 0; | ||||||
|  |   int _pageSize = 10; | ||||||
|  |   bool _hasMoreData = true; | ||||||
|  |   String _searchQuery = ''; | ||||||
|  | 
 | ||||||
|  |   // Getters | ||||||
|  |   List<Map<String, dynamic>> get basicp3List => _basicp3List; | ||||||
|  |   List<Map<String, dynamic>> 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 basicp3 list | ||||||
|  |   Future<void> getEntities() async { | ||||||
|  |     _setLoading(true); | ||||||
|  |     _setError(''); | ||||||
|  | 
 | ||||||
|  |     try { | ||||||
|  |       final response = await repo.getEntities(); | ||||||
|  | 
 | ||||||
|  |       if (response.status == Status.SUCCESS) { | ||||||
|  |         _basicp3List = response.data ?? []; | ||||||
|  |         _filteredList = List.from(_basicp3List); | ||||||
|  |         _currentPage = 0; | ||||||
|  |         _hasMoreData = true; | ||||||
|  |       } else { | ||||||
|  |         _setError(response.message ?? 'Failed to fetch basicp3 list'); | ||||||
|  |       } | ||||||
|  |     } catch (e) { | ||||||
|  |       _setError('Failed to fetch basicp3 list: $e'); | ||||||
|  |     } finally { | ||||||
|  |       _setLoading(false); | ||||||
|  |     } | ||||||
|  |   } | ||||||
|  | 
 | ||||||
|  |   // Get basicp3 list with pagination | ||||||
|  |   Future<void> getAllWithPagination({bool refresh = false}) async { | ||||||
|  |     if (refresh) { | ||||||
|  |       _currentPage = 0; | ||||||
|  |       _basicp3List.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) { | ||||||
|  |           _basicp3List = newItems; | ||||||
|  |         } else { | ||||||
|  |           _basicp3List.addAll(newItems); | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |         _filteredList = List.from(_basicp3List); | ||||||
|  |         _currentPage++; | ||||||
|  | 
 | ||||||
|  |         // Check if we have more data | ||||||
|  |         _hasMoreData = newItems.length == _pageSize; | ||||||
|  |       } else { | ||||||
|  |         _setError(response.message ?? 'Failed to fetch Basicp3 list'); | ||||||
|  |       } | ||||||
|  |     } catch (e) { | ||||||
|  |       _setError('Failed to fetch basicp3 list: $e'); | ||||||
|  |     } finally { | ||||||
|  |       _setLoading(false); | ||||||
|  |     } | ||||||
|  |   } | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |   // Create Basicp3 | ||||||
|  |   Future<bool> createEntity(Map<String, dynamic> 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: 'basicp3 created successfully', | ||||||
|  |           toastType: ToastType.success, | ||||||
|  |         ); | ||||||
|  | 
 | ||||||
|  |         // Refresh the list | ||||||
|  |         await getEntities(); | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |         return true; | ||||||
|  |       } else { | ||||||
|  |         _setError(response.message ?? 'Failed to create Basicp3'); | ||||||
|  |         ToastMessageUtil.showToast( | ||||||
|  |           message: response.message ?? 'Failed to create Basicp3', | ||||||
|  |           toastType: ToastType.error, | ||||||
|  |         ); | ||||||
|  |         return false; | ||||||
|  |       } | ||||||
|  |     } catch (e) { | ||||||
|  |       _setError('Failed to create basicp3: $e'); | ||||||
|  |       ToastMessageUtil.showToast( | ||||||
|  |         message: 'Failed to create Basicp3: $e', | ||||||
|  |         toastType: ToastType.error, | ||||||
|  |       ); | ||||||
|  |       return false; | ||||||
|  |     } finally { | ||||||
|  |       _setLoading(false); | ||||||
|  |     } | ||||||
|  |   } | ||||||
|  | 
 | ||||||
|  |   // Update basicp3 | ||||||
|  |   Future<bool> updateEntity(int id, Map<String, dynamic> entity) async { | ||||||
|  |     _setLoading(true); | ||||||
|  |     _setError(''); | ||||||
|  | 
 | ||||||
|  |     try { | ||||||
|  |       final response = await repo.updateEntity(id, entity); | ||||||
|  | 
 | ||||||
|  |       if (response.status == Status.SUCCESS) { | ||||||
|  |         ToastMessageUtil.showToast( | ||||||
|  |           message: 'Basicp3 updated successfully', | ||||||
|  |           toastType: ToastType.success, | ||||||
|  |         ); | ||||||
|  | 
 | ||||||
|  |         // Update the item in the list | ||||||
|  |         final index = _basicp3List.indexWhere((item) => item['id'] == id); | ||||||
|  |         if (index != -1) { | ||||||
|  |           _basicp3List[index] = response.data!; | ||||||
|  |           _filteredList = List.from(_basicp3List); | ||||||
|  |           notifyListeners(); | ||||||
|  |         } | ||||||
|  |         return true; | ||||||
|  |       } else { | ||||||
|  |         _setError(response.message ?? 'Failed to update Basicp3'); | ||||||
|  |         ToastMessageUtil.showToast( | ||||||
|  |           message: response.message ?? 'Failed to update Basicp3', | ||||||
|  |           toastType: ToastType.error, | ||||||
|  |         ); | ||||||
|  |         return false; | ||||||
|  |       } | ||||||
|  |     } catch (e) { | ||||||
|  |       _setError('Failed to update basicp3: $e'); | ||||||
|  |       ToastMessageUtil.showToast( | ||||||
|  |         message: 'Failed to update Basicp3: $e', | ||||||
|  |         toastType: ToastType.error, | ||||||
|  |       ); | ||||||
|  |       return false; | ||||||
|  |     } finally { | ||||||
|  |       _setLoading(false); | ||||||
|  |     } | ||||||
|  |   } | ||||||
|  | 
 | ||||||
|  |   // Delete basicp3 | ||||||
|  |   Future<bool> deleteEntity(int id) async { | ||||||
|  |     _setLoading(true); | ||||||
|  |     _setError(''); | ||||||
|  | 
 | ||||||
|  |     try { | ||||||
|  |       final response = await repo.deleteEntity(id); | ||||||
|  | 
 | ||||||
|  |       if (response.status == Status.SUCCESS) { | ||||||
|  |         ToastMessageUtil.showToast( | ||||||
|  |           message: 'Basicp3 deleted successfully', | ||||||
|  |           toastType: ToastType.success, | ||||||
|  |         ); | ||||||
|  | 
 | ||||||
|  |         // Remove the item from the list | ||||||
|  |         _basicp3List.removeWhere((item) => item['id'] == id); | ||||||
|  |         _filteredList = List.from(_basicp3List); | ||||||
|  |         notifyListeners(); | ||||||
|  |         return true; | ||||||
|  |       } else { | ||||||
|  |         _setError(response.message ?? 'Failed to delete Basicp3'); | ||||||
|  |         ToastMessageUtil.showToast( | ||||||
|  |           message: response.message ?? 'Failed to delete Basicp3', | ||||||
|  |           toastType: ToastType.error, | ||||||
|  |         ); | ||||||
|  |         return false; | ||||||
|  |       } | ||||||
|  |     } catch (e) { | ||||||
|  |       _setError('Failed to delete basicp3: $e'); | ||||||
|  |       ToastMessageUtil.showToast( | ||||||
|  |         message: 'Failed to delete Basicp3: $e', | ||||||
|  |         toastType: ToastType.error, | ||||||
|  |       ); | ||||||
|  |       return false; | ||||||
|  |     } finally { | ||||||
|  |       _setLoading(false); | ||||||
|  |     } | ||||||
|  |   } | ||||||
|  | 
 | ||||||
|  |   // Search basicp3 | ||||||
|  |   void searchbasicp3(String query) { | ||||||
|  |     _searchQuery = query; | ||||||
|  | 
 | ||||||
|  |     if (query.isEmpty) { | ||||||
|  |       _filteredList = List.from(_basicp3List); | ||||||
|  |     } else { | ||||||
|  |       _filteredList = _basicp3List.where((item) { | ||||||
|  |         return(item['toggle_switch']?.toString().toLowerCase().contains(query.toLowerCase()) ??false) || | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | (item['toggle_switch2']?.toString().toLowerCase().contains(query.toLowerCase()) ??false) || | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |               | ||||||
|  | (item['url_field']?.toString().toLowerCase().contains(query.toLowerCase()) ??false) || | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |               | ||||||
|  | (item['url_field2']?.toString().toLowerCase().contains(query.toLowerCase()) ??false) || | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |               | ||||||
|  | (item['decimal_field']?.toString().toLowerCase().contains(query.toLowerCase()) ??false) || | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |               | ||||||
|  | (item['decimal_field2']?.toString().toLowerCase().contains(query.toLowerCase()) ??false) || | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |               | ||||||
|  | (item['percentage_field']?.toString().toLowerCase().contains(query.toLowerCase()) ??false) || | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |               | ||||||
|  | (item['percentage_field2']?.toString().toLowerCase().contains(query.toLowerCase()) ??false) || | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |               | ||||||
|  | (item['documentsequenc']?.toString().toLowerCase().contains(query.toLowerCase()) ??false)  | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | ; | ||||||
|  |       }).toList(); | ||||||
|  |     } | ||||||
|  |     notifyListeners(); | ||||||
|  |   } | ||||||
|  | 
 | ||||||
|  |   // Clear search | ||||||
|  |   void clearSearch() { | ||||||
|  |     _searchQuery = ''; | ||||||
|  |     _filteredList = List.from(_basicp3List); | ||||||
|  |     notifyListeners(); | ||||||
|  |   } | ||||||
|  | 
 | ||||||
|  |   // Refresh data | ||||||
|  |   Future<void> refreshData() async { | ||||||
|  |     await getAllWithPagination(refresh: true); | ||||||
|  |   } | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | } | ||||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| @ -69,6 +69,15 @@ public class BuilderService { | |||||||
| 		executeDump(true); | 		executeDump(true); | ||||||
| 
 | 
 | ||||||
| 		// ADD OTHER SERVICE | 		// ADD OTHER SERVICE | ||||||
|  | addCustomMenu( "Basicp3","Basicp3",  "Transcations");  | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | addCustomMenu( "Basicp2","Basicp2",  "Transcations");  | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | addCustomMenu( "Basicp1","Basicp1",  "Transcations");  | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
| 
 | 
 | ||||||
| 		System.out.println("dashboard and menu inserted..."); | 		System.out.println("dashboard and menu inserted..."); | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -0,0 +1,171 @@ | |||||||
|  | package com.realnet.angulardatatype.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.angulardatatype.Entity.Basicp1; | ||||||
|  | import com.realnet.angulardatatype.Services.Basicp1Service ; | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | @RequestMapping(value = "/Basicp1") | ||||||
|  |  @CrossOrigin("*")  | ||||||
|  | @RestController | ||||||
|  | public class Basicp1Controller { | ||||||
|  | 	@Autowired | ||||||
|  | 	private Basicp1Service Service; | ||||||
|  | 
 | ||||||
|  | @Value("${projectPath}") | ||||||
|  | 	private String projectPath; | ||||||
|  |   | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 	@PostMapping("/Basicp1") | ||||||
|  | 		  public Basicp1 Savedata(@RequestBody Basicp1 data) { | ||||||
|  | 		Basicp1 save = Service.Savedata(data)	; | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 		System.out.println("data saved..." + save); | ||||||
|  | 
 | ||||||
|  |  return save; | ||||||
|  | 	  } | ||||||
|  | @PutMapping("/Basicp1/{id}") | ||||||
|  | 	public  Basicp1 update(@RequestBody Basicp1 data,@PathVariable Integer id ) { | ||||||
|  | 		Basicp1 update = Service.update(data,id); | ||||||
|  | 		System.out.println("data update..." + update); | ||||||
|  | 		return update; | ||||||
|  | 	}	  | ||||||
|  | //	get all with pagination | ||||||
|  | 	@GetMapping("/Basicp1/getall/page") | ||||||
|  | 	public Page<Basicp1> getall(@RequestParam(value = "page", required = false) Integer page, | ||||||
|  | 			@RequestParam(value = "size", required = false) Integer size) { | ||||||
|  | 		Pageable paging = PageRequest.of(page, size); | ||||||
|  | 		Page<Basicp1> get = Service.getAllWithPagination(paging); | ||||||
|  | 
 | ||||||
|  | 		return get; | ||||||
|  | 
 | ||||||
|  | 	}	 | ||||||
|  | 	@GetMapping("/Basicp1") | ||||||
|  | 	public List<Basicp1> getdetails() { | ||||||
|  | 		 List<Basicp1> get = Service.getdetails();		 | ||||||
|  | 		return get; | ||||||
|  | } | ||||||
|  | // get all without authentication  | ||||||
|  | 
 | ||||||
|  | 	@GetMapping("/token/Basicp1") | ||||||
|  | 	public List<Basicp1> getallwioutsec() { | ||||||
|  | 		 List<Basicp1> get = Service.getdetails();		 | ||||||
|  | 		return get; | ||||||
|  | } | ||||||
|  | @GetMapping("/Basicp1/{id}") | ||||||
|  | 	public  Basicp1  getdetailsbyId(@PathVariable Integer id ) { | ||||||
|  | 		Basicp1  get = Service.getdetailsbyId(id); | ||||||
|  | 		return get; | ||||||
|  | 	} | ||||||
|  | @DeleteMapping("/Basicp1/{id}") | ||||||
|  | 	public  ResponseEntity<?> delete_by_id(@PathVariable Integer id ) { | ||||||
|  | 	Service.delete_by_id(id); | ||||||
|  | 			return new ResponseEntity<>(new EntityResponse("Deleted"), HttpStatus.OK); | ||||||
|  | 	 | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | } | ||||||
| @ -0,0 +1,147 @@ | |||||||
|  | package com.realnet.angulardatatype.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.angulardatatype.Entity.Basicp2; | ||||||
|  | import com.realnet.angulardatatype.Services.Basicp2Service ; | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | @RequestMapping(value = "/Basicp2") | ||||||
|  |  @CrossOrigin("*")  | ||||||
|  | @RestController | ||||||
|  | public class Basicp2Controller { | ||||||
|  | 	@Autowired | ||||||
|  | 	private Basicp2Service Service; | ||||||
|  | 
 | ||||||
|  | @Value("${projectPath}") | ||||||
|  | 	private String projectPath; | ||||||
|  |   | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 	@PostMapping("/Basicp2") | ||||||
|  | 		  public Basicp2 Savedata(@RequestBody Basicp2 data) { | ||||||
|  | 		Basicp2 save = Service.Savedata(data)	; | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 		System.out.println("data saved..." + save); | ||||||
|  | 
 | ||||||
|  |  return save; | ||||||
|  | 	  } | ||||||
|  | @PutMapping("/Basicp2/{id}") | ||||||
|  | 	public  Basicp2 update(@RequestBody Basicp2 data,@PathVariable Integer id ) { | ||||||
|  | 		Basicp2 update = Service.update(data,id); | ||||||
|  | 		System.out.println("data update..." + update); | ||||||
|  | 		return update; | ||||||
|  | 	}	  | ||||||
|  | //	get all with pagination | ||||||
|  | 	@GetMapping("/Basicp2/getall/page") | ||||||
|  | 	public Page<Basicp2> getall(@RequestParam(value = "page", required = false) Integer page, | ||||||
|  | 			@RequestParam(value = "size", required = false) Integer size) { | ||||||
|  | 		Pageable paging = PageRequest.of(page, size); | ||||||
|  | 		Page<Basicp2> get = Service.getAllWithPagination(paging); | ||||||
|  | 
 | ||||||
|  | 		return get; | ||||||
|  | 
 | ||||||
|  | 	}	 | ||||||
|  | 	@GetMapping("/Basicp2") | ||||||
|  | 	public List<Basicp2> getdetails() { | ||||||
|  | 		 List<Basicp2> get = Service.getdetails();		 | ||||||
|  | 		return get; | ||||||
|  | } | ||||||
|  | // get all without authentication  | ||||||
|  | 
 | ||||||
|  | 	@GetMapping("/token/Basicp2") | ||||||
|  | 	public List<Basicp2> getallwioutsec() { | ||||||
|  | 		 List<Basicp2> get = Service.getdetails();		 | ||||||
|  | 		return get; | ||||||
|  | } | ||||||
|  | @GetMapping("/Basicp2/{id}") | ||||||
|  | 	public  Basicp2  getdetailsbyId(@PathVariable Integer id ) { | ||||||
|  | 		Basicp2  get = Service.getdetailsbyId(id); | ||||||
|  | 		return get; | ||||||
|  | 	} | ||||||
|  | @DeleteMapping("/Basicp2/{id}") | ||||||
|  | 	public  ResponseEntity<?> delete_by_id(@PathVariable Integer id ) { | ||||||
|  | 	Service.delete_by_id(id); | ||||||
|  | 			return new ResponseEntity<>(new EntityResponse("Deleted"), HttpStatus.OK); | ||||||
|  | 	 | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | } | ||||||
| @ -0,0 +1,163 @@ | |||||||
|  | package com.realnet.angulardatatype.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.angulardatatype.Entity.Basicp3; | ||||||
|  | import com.realnet.angulardatatype.Services.Basicp3Service ; | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | @RequestMapping(value = "/Basicp3") | ||||||
|  |  @CrossOrigin("*")  | ||||||
|  | @RestController | ||||||
|  | public class Basicp3Controller { | ||||||
|  | 	@Autowired | ||||||
|  | 	private Basicp3Service Service; | ||||||
|  | 
 | ||||||
|  | @Value("${projectPath}") | ||||||
|  | 	private String projectPath; | ||||||
|  |   | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 	@PostMapping("/Basicp3") | ||||||
|  | 		  public Basicp3 Savedata(@RequestBody Basicp3 data) { | ||||||
|  | 		Basicp3 save = Service.Savedata(data)	; | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 		System.out.println("data saved..." + save); | ||||||
|  | 
 | ||||||
|  |  return save; | ||||||
|  | 	  } | ||||||
|  | @PutMapping("/Basicp3/{id}") | ||||||
|  | 	public  Basicp3 update(@RequestBody Basicp3 data,@PathVariable Integer id ) { | ||||||
|  | 		Basicp3 update = Service.update(data,id); | ||||||
|  | 		System.out.println("data update..." + update); | ||||||
|  | 		return update; | ||||||
|  | 	}	  | ||||||
|  | //	get all with pagination | ||||||
|  | 	@GetMapping("/Basicp3/getall/page") | ||||||
|  | 	public Page<Basicp3> getall(@RequestParam(value = "page", required = false) Integer page, | ||||||
|  | 			@RequestParam(value = "size", required = false) Integer size) { | ||||||
|  | 		Pageable paging = PageRequest.of(page, size); | ||||||
|  | 		Page<Basicp3> get = Service.getAllWithPagination(paging); | ||||||
|  | 
 | ||||||
|  | 		return get; | ||||||
|  | 
 | ||||||
|  | 	}	 | ||||||
|  | 	@GetMapping("/Basicp3") | ||||||
|  | 	public List<Basicp3> getdetails() { | ||||||
|  | 		 List<Basicp3> get = Service.getdetails();		 | ||||||
|  | 		return get; | ||||||
|  | } | ||||||
|  | // get all without authentication  | ||||||
|  | 
 | ||||||
|  | 	@GetMapping("/token/Basicp3") | ||||||
|  | 	public List<Basicp3> getallwioutsec() { | ||||||
|  | 		 List<Basicp3> get = Service.getdetails();		 | ||||||
|  | 		return get; | ||||||
|  | } | ||||||
|  | @GetMapping("/Basicp3/{id}") | ||||||
|  | 	public  Basicp3  getdetailsbyId(@PathVariable Integer id ) { | ||||||
|  | 		Basicp3  get = Service.getdetailsbyId(id); | ||||||
|  | 		return get; | ||||||
|  | 	} | ||||||
|  | @DeleteMapping("/Basicp3/{id}") | ||||||
|  | 	public  ResponseEntity<?> delete_by_id(@PathVariable Integer id ) { | ||||||
|  | 	Service.delete_by_id(id); | ||||||
|  | 			return new ResponseEntity<>(new EntityResponse("Deleted"), HttpStatus.OK); | ||||||
|  | 	 | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | } | ||||||
| @ -0,0 +1,171 @@ | |||||||
|  | package com.realnet.angulardatatype.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.angulardatatype.Entity.Basicp1; | ||||||
|  | import com.realnet.angulardatatype.Services.Basicp1Service ; | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | @RequestMapping(value = "/token/Basicp1") | ||||||
|  |  @CrossOrigin("*")  | ||||||
|  | @RestController | ||||||
|  | public class tokenFree_Basicp1Controller { | ||||||
|  | 	@Autowired | ||||||
|  | 	private Basicp1Service Service; | ||||||
|  | 
 | ||||||
|  | @Value("${projectPath}") | ||||||
|  | 	private String projectPath; | ||||||
|  |   | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 	@PostMapping("/Basicp1") | ||||||
|  | 		  public Basicp1 Savedata(@RequestBody Basicp1 data) { | ||||||
|  | 		Basicp1 save = Service.Savedata(data)	; | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 		System.out.println("data saved..." + save); | ||||||
|  | 
 | ||||||
|  |  return save; | ||||||
|  | 	  } | ||||||
|  | @PutMapping("/Basicp1/{id}") | ||||||
|  | 	public  Basicp1 update(@RequestBody Basicp1 data,@PathVariable Integer id ) { | ||||||
|  | 		Basicp1 update = Service.update(data,id); | ||||||
|  | 		System.out.println("data update..." + update); | ||||||
|  | 		return update; | ||||||
|  | 	}	  | ||||||
|  | //	get all with pagination | ||||||
|  | 	@GetMapping("/Basicp1/getall/page") | ||||||
|  | 	public Page<Basicp1> getall(@RequestParam(value = "page", required = false) Integer page, | ||||||
|  | 			@RequestParam(value = "size", required = false) Integer size) { | ||||||
|  | 		Pageable paging = PageRequest.of(page, size); | ||||||
|  | 		Page<Basicp1> get = Service.getAllWithPagination(paging); | ||||||
|  | 
 | ||||||
|  | 		return get; | ||||||
|  | 
 | ||||||
|  | 	}	 | ||||||
|  | 	@GetMapping("/Basicp1") | ||||||
|  | 	public List<Basicp1> getdetails() { | ||||||
|  | 		 List<Basicp1> get = Service.getdetails();		 | ||||||
|  | 		return get; | ||||||
|  | } | ||||||
|  | // get all without authentication  | ||||||
|  | 
 | ||||||
|  | 	@GetMapping("/token/Basicp1") | ||||||
|  | 	public List<Basicp1> getallwioutsec() { | ||||||
|  | 		 List<Basicp1> get = Service.getdetails();		 | ||||||
|  | 		return get; | ||||||
|  | } | ||||||
|  | @GetMapping("/Basicp1/{id}") | ||||||
|  | 	public  Basicp1  getdetailsbyId(@PathVariable Integer id ) { | ||||||
|  | 		Basicp1  get = Service.getdetailsbyId(id); | ||||||
|  | 		return get; | ||||||
|  | 	} | ||||||
|  | @DeleteMapping("/Basicp1/{id}") | ||||||
|  | 	public  ResponseEntity<?> delete_by_id(@PathVariable Integer id ) { | ||||||
|  | 	Service.delete_by_id(id); | ||||||
|  | 			return new ResponseEntity<>(new EntityResponse("Deleted"), HttpStatus.OK); | ||||||
|  | 	 | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | } | ||||||
| @ -0,0 +1,147 @@ | |||||||
|  | package com.realnet.angulardatatype.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.angulardatatype.Entity.Basicp2; | ||||||
|  | import com.realnet.angulardatatype.Services.Basicp2Service ; | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | @RequestMapping(value = "/token/Basicp2") | ||||||
|  |  @CrossOrigin("*")  | ||||||
|  | @RestController | ||||||
|  | public class tokenFree_Basicp2Controller { | ||||||
|  | 	@Autowired | ||||||
|  | 	private Basicp2Service Service; | ||||||
|  | 
 | ||||||
|  | @Value("${projectPath}") | ||||||
|  | 	private String projectPath; | ||||||
|  |   | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 	@PostMapping("/Basicp2") | ||||||
|  | 		  public Basicp2 Savedata(@RequestBody Basicp2 data) { | ||||||
|  | 		Basicp2 save = Service.Savedata(data)	; | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 		System.out.println("data saved..." + save); | ||||||
|  | 
 | ||||||
|  |  return save; | ||||||
|  | 	  } | ||||||
|  | @PutMapping("/Basicp2/{id}") | ||||||
|  | 	public  Basicp2 update(@RequestBody Basicp2 data,@PathVariable Integer id ) { | ||||||
|  | 		Basicp2 update = Service.update(data,id); | ||||||
|  | 		System.out.println("data update..." + update); | ||||||
|  | 		return update; | ||||||
|  | 	}	  | ||||||
|  | //	get all with pagination | ||||||
|  | 	@GetMapping("/Basicp2/getall/page") | ||||||
|  | 	public Page<Basicp2> getall(@RequestParam(value = "page", required = false) Integer page, | ||||||
|  | 			@RequestParam(value = "size", required = false) Integer size) { | ||||||
|  | 		Pageable paging = PageRequest.of(page, size); | ||||||
|  | 		Page<Basicp2> get = Service.getAllWithPagination(paging); | ||||||
|  | 
 | ||||||
|  | 		return get; | ||||||
|  | 
 | ||||||
|  | 	}	 | ||||||
|  | 	@GetMapping("/Basicp2") | ||||||
|  | 	public List<Basicp2> getdetails() { | ||||||
|  | 		 List<Basicp2> get = Service.getdetails();		 | ||||||
|  | 		return get; | ||||||
|  | } | ||||||
|  | // get all without authentication  | ||||||
|  | 
 | ||||||
|  | 	@GetMapping("/token/Basicp2") | ||||||
|  | 	public List<Basicp2> getallwioutsec() { | ||||||
|  | 		 List<Basicp2> get = Service.getdetails();		 | ||||||
|  | 		return get; | ||||||
|  | } | ||||||
|  | @GetMapping("/Basicp2/{id}") | ||||||
|  | 	public  Basicp2  getdetailsbyId(@PathVariable Integer id ) { | ||||||
|  | 		Basicp2  get = Service.getdetailsbyId(id); | ||||||
|  | 		return get; | ||||||
|  | 	} | ||||||
|  | @DeleteMapping("/Basicp2/{id}") | ||||||
|  | 	public  ResponseEntity<?> delete_by_id(@PathVariable Integer id ) { | ||||||
|  | 	Service.delete_by_id(id); | ||||||
|  | 			return new ResponseEntity<>(new EntityResponse("Deleted"), HttpStatus.OK); | ||||||
|  | 	 | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | } | ||||||
| @ -0,0 +1,163 @@ | |||||||
|  | package com.realnet.angulardatatype.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.angulardatatype.Entity.Basicp3; | ||||||
|  | import com.realnet.angulardatatype.Services.Basicp3Service ; | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | @RequestMapping(value = "/token/Basicp3") | ||||||
|  |  @CrossOrigin("*")  | ||||||
|  | @RestController | ||||||
|  | public class tokenFree_Basicp3Controller { | ||||||
|  | 	@Autowired | ||||||
|  | 	private Basicp3Service Service; | ||||||
|  | 
 | ||||||
|  | @Value("${projectPath}") | ||||||
|  | 	private String projectPath; | ||||||
|  |   | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 	@PostMapping("/Basicp3") | ||||||
|  | 		  public Basicp3 Savedata(@RequestBody Basicp3 data) { | ||||||
|  | 		Basicp3 save = Service.Savedata(data)	; | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 		System.out.println("data saved..." + save); | ||||||
|  | 
 | ||||||
|  |  return save; | ||||||
|  | 	  } | ||||||
|  | @PutMapping("/Basicp3/{id}") | ||||||
|  | 	public  Basicp3 update(@RequestBody Basicp3 data,@PathVariable Integer id ) { | ||||||
|  | 		Basicp3 update = Service.update(data,id); | ||||||
|  | 		System.out.println("data update..." + update); | ||||||
|  | 		return update; | ||||||
|  | 	}	  | ||||||
|  | //	get all with pagination | ||||||
|  | 	@GetMapping("/Basicp3/getall/page") | ||||||
|  | 	public Page<Basicp3> getall(@RequestParam(value = "page", required = false) Integer page, | ||||||
|  | 			@RequestParam(value = "size", required = false) Integer size) { | ||||||
|  | 		Pageable paging = PageRequest.of(page, size); | ||||||
|  | 		Page<Basicp3> get = Service.getAllWithPagination(paging); | ||||||
|  | 
 | ||||||
|  | 		return get; | ||||||
|  | 
 | ||||||
|  | 	}	 | ||||||
|  | 	@GetMapping("/Basicp3") | ||||||
|  | 	public List<Basicp3> getdetails() { | ||||||
|  | 		 List<Basicp3> get = Service.getdetails();		 | ||||||
|  | 		return get; | ||||||
|  | } | ||||||
|  | // get all without authentication  | ||||||
|  | 
 | ||||||
|  | 	@GetMapping("/token/Basicp3") | ||||||
|  | 	public List<Basicp3> getallwioutsec() { | ||||||
|  | 		 List<Basicp3> get = Service.getdetails();		 | ||||||
|  | 		return get; | ||||||
|  | } | ||||||
|  | @GetMapping("/Basicp3/{id}") | ||||||
|  | 	public  Basicp3  getdetailsbyId(@PathVariable Integer id ) { | ||||||
|  | 		Basicp3  get = Service.getdetailsbyId(id); | ||||||
|  | 		return get; | ||||||
|  | 	} | ||||||
|  | @DeleteMapping("/Basicp3/{id}") | ||||||
|  | 	public  ResponseEntity<?> delete_by_id(@PathVariable Integer id ) { | ||||||
|  | 	Service.delete_by_id(id); | ||||||
|  | 			return new ResponseEntity<>(new EntityResponse("Deleted"), HttpStatus.OK); | ||||||
|  | 	 | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | } | ||||||
| @ -0,0 +1,77 @@ | |||||||
|  | package com.realnet.angulardatatype.Entity; | ||||||
|  |  import lombok.*; | ||||||
|  | import com.realnet.WhoColumn.Entity.Extension;  | ||||||
|  |  import javax.persistence.*; | ||||||
|  |  import java.time.LocalDateTime; | ||||||
|  |  import java.util.*; | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |  @Entity  | ||||||
|  |  @Data | ||||||
|  |  public class    Basicp1 extends Extension {  | ||||||
|  |  /** | ||||||
|  | 	 *  | ||||||
|  | 	 */ | ||||||
|  | 	private static final long serialVersionUID = 1L; | ||||||
|  | 
 | ||||||
|  |  @Id | ||||||
|  |  @GeneratedValue(strategy = GenerationType.IDENTITY) | ||||||
|  |  private Integer id; | ||||||
|  | 
 | ||||||
|  | private String  name; | ||||||
|  | 
 | ||||||
|  | private String  name2; | ||||||
|  | 
 | ||||||
|  | private int number1; | ||||||
|  | 
 | ||||||
|  | private int number2; | ||||||
|  | 
 | ||||||
|  |  private String phone_number; | ||||||
|  | 
 | ||||||
|  |  private String phone_number2; | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | @Column(length = 2000) | ||||||
|  | private String paragraph_field; | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | @Column(length = 2000) | ||||||
|  | private String paragraph_field2; | ||||||
|  | 
 | ||||||
|  | private String password_field; | ||||||
|  | @Transient | ||||||
|  | private String confirmpassword_field; | ||||||
|  | 
 | ||||||
|  | @Column(length = 2000) | ||||||
|  | private String textarea; | ||||||
|  | 
 | ||||||
|  | @Column(length = 2000) | ||||||
|  | private String textarea_field; | ||||||
|  | 
 | ||||||
|  | @Column(length = 2000) | ||||||
|  | private String textarea_field2; | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | } | ||||||
| @ -0,0 +1,59 @@ | |||||||
|  | package com.realnet.angulardatatype.Entity; | ||||||
|  |  import lombok.*; | ||||||
|  | import com.realnet.WhoColumn.Entity.Extension;  | ||||||
|  |  import javax.persistence.*; | ||||||
|  |  import java.time.LocalDateTime; | ||||||
|  |  import java.util.*; | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |  @Entity  | ||||||
|  |  @Data | ||||||
|  |  public class    Basicp2 extends Extension {  | ||||||
|  |  /** | ||||||
|  | 	 *  | ||||||
|  | 	 */ | ||||||
|  | 	private static final long serialVersionUID = 1L; | ||||||
|  | 
 | ||||||
|  |  @Id | ||||||
|  |  @GeneratedValue(strategy = GenerationType.IDENTITY) | ||||||
|  |  private Integer id; | ||||||
|  | 
 | ||||||
|  | @Column(length = 2000) | ||||||
|  | private String about; | ||||||
|  | 
 | ||||||
|  | @Column(length = 2000) | ||||||
|  | private String textarea2; | ||||||
|  | 
 | ||||||
|  | private String date_field; | ||||||
|  | 
 | ||||||
|  | private String date_field2; | ||||||
|  | 
 | ||||||
|  | private String datetime_field; | ||||||
|  | 
 | ||||||
|  | private String datetime_field2; | ||||||
|  | 
 | ||||||
|  | private String email_field; | ||||||
|  | 
 | ||||||
|  | private String email_field2; | ||||||
|  | 
 | ||||||
|  | 	private Long user_id; | ||||||
|  | 	private String user_name; | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | } | ||||||
| @ -0,0 +1,64 @@ | |||||||
|  | package com.realnet.angulardatatype.Entity; | ||||||
|  |  import lombok.*; | ||||||
|  | import com.realnet.WhoColumn.Entity.Extension;  | ||||||
|  |  import javax.persistence.*; | ||||||
|  |  import java.time.LocalDateTime; | ||||||
|  |  import java.util.*; | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |  @Entity  | ||||||
|  |  @Data | ||||||
|  |  public class    Basicp3 extends Extension {  | ||||||
|  |  /** | ||||||
|  | 	 *  | ||||||
|  | 	 */ | ||||||
|  | 	private static final long serialVersionUID = 1L; | ||||||
|  | 
 | ||||||
|  |  @Id | ||||||
|  |  @GeneratedValue(strategy = GenerationType.IDENTITY) | ||||||
|  |  private Integer id; | ||||||
|  | 
 | ||||||
|  | private Boolean toggle_switch; | ||||||
|  | 
 | ||||||
|  | private Boolean toggle_switch2; | ||||||
|  | 
 | ||||||
|  | private String url_field; | ||||||
|  | 
 | ||||||
|  | private String url_field2; | ||||||
|  | 
 | ||||||
|  |  private double decimal_field; | ||||||
|  | 
 | ||||||
|  |  private double decimal_field2; | ||||||
|  | 
 | ||||||
|  | private int percentage_field; | ||||||
|  | 
 | ||||||
|  | private int percentage_field2; | ||||||
|  | 
 | ||||||
|  | private String documentsequenc; | ||||||
|  | 
 | ||||||
|  | private String recaptcha; | ||||||
|  | 
 | ||||||
|  | private String recaptcha2; | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | } | ||||||
| @ -0,0 +1,48 @@ | |||||||
|  | package com.realnet.angulardatatype.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.angulardatatype.Entity.Basicp1; | ||||||
|  | 
 | ||||||
|  | @Repository | ||||||
|  | public interface  Basicp1Repository  extends  JpaRepository<Basicp1, Integer>  {  | ||||||
|  | 
 | ||||||
|  | @Query(value = "select * from basicp1 where  created_by=?1", nativeQuery = true) | ||||||
|  | 	List<Basicp1> findAll(Long creayedBy); | ||||||
|  | 
 | ||||||
|  | @Query(value = "select * from basicp1 where  created_by=?1", nativeQuery = true) | ||||||
|  | 	Page<Basicp1> findAll( Long creayedBy,Pageable page); | ||||||
|  | } | ||||||
| @ -0,0 +1,42 @@ | |||||||
|  | package com.realnet.angulardatatype.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.angulardatatype.Entity.Basicp2; | ||||||
|  | 
 | ||||||
|  | @Repository | ||||||
|  | public interface  Basicp2Repository  extends  JpaRepository<Basicp2, Integer>  {  | ||||||
|  | 
 | ||||||
|  | @Query(value = "select * from basicp2 where  created_by=?1", nativeQuery = true) | ||||||
|  | 	List<Basicp2> findAll(Long creayedBy); | ||||||
|  | 
 | ||||||
|  | @Query(value = "select * from basicp2 where  created_by=?1", nativeQuery = true) | ||||||
|  | 	Page<Basicp2> findAll( Long creayedBy,Pageable page); | ||||||
|  | } | ||||||
| @ -0,0 +1,46 @@ | |||||||
|  | package com.realnet.angulardatatype.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.angulardatatype.Entity.Basicp3; | ||||||
|  | 
 | ||||||
|  | @Repository | ||||||
|  | public interface  Basicp3Repository  extends  JpaRepository<Basicp3, Integer>  {  | ||||||
|  | 
 | ||||||
|  | @Query(value = "select * from basicp3 where  created_by=?1", nativeQuery = true) | ||||||
|  | 	List<Basicp3> findAll(Long creayedBy); | ||||||
|  | 
 | ||||||
|  | @Query(value = "select * from basicp3 where  created_by=?1", nativeQuery = true) | ||||||
|  | 	Page<Basicp3> findAll( Long creayedBy,Pageable page); | ||||||
|  | } | ||||||
| @ -0,0 +1,183 @@ | |||||||
|  | package com.realnet.angulardatatype.Services; | ||||||
|  | import com.realnet.angulardatatype.Repository.Basicp1Repository; | ||||||
|  | import com.realnet.angulardatatype.Entity.Basicp1 | ||||||
|  | ;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 Basicp1Service { | ||||||
|  | @Autowired | ||||||
|  | private Basicp1Repository Repository; | ||||||
|  | 	@Autowired | ||||||
|  | 	private AppUserServiceImpl userService;  | ||||||
|  | @Autowired | ||||||
|  | 	private RealmService realmService; | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | public Basicp1 Savedata(Basicp1 data) { | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 	data.setUpdatedBy(getUser().getUserId()); | ||||||
|  | 		data.setCreatedBy(getUser().getUserId()); | ||||||
|  | 		data.setAccountId(getUser().getAccount().getAccount_id()); | ||||||
|  | Basicp1 save = Repository.save(data); | ||||||
|  | 				return save;	 | ||||||
|  | 			} | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | //	get all with pagination | ||||||
|  | 	public Page<Basicp1> getAllWithPagination(Pageable page) { | ||||||
|  | 		return Repository.findAll( getUser().getUserId(),page); | ||||||
|  | 	}			 | ||||||
|  | public List<Basicp1> getdetails() {   | ||||||
|  | 		List<Realm> realm = realmService.findByUserId(getUser().getUserId()); | ||||||
|  | List<Basicp1> all = Repository.findAll(getUser().getUserId()); | ||||||
|  | 		 | ||||||
|  | 		return all ;		} | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | public Basicp1 getdetailsbyId(Integer id) { | ||||||
|  | 	return Repository.findById(id).get(); | ||||||
|  | 			} | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 	public void delete_by_id(Integer id) { | ||||||
|  |  Repository.deleteById(id); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | public Basicp1 update(Basicp1 data,Integer id) { | ||||||
|  | 	Basicp1 old = Repository.findById(id).get(); | ||||||
|  | old.setName(data.getName()); | ||||||
|  | 
 | ||||||
|  | old.setName2(data.getName2()); | ||||||
|  | 
 | ||||||
|  | old.setNumber1(data.getNumber1()); | ||||||
|  | 
 | ||||||
|  | old.setNumber2(data.getNumber2()); | ||||||
|  | 
 | ||||||
|  | old.setPhone_number(data.getPhone_number()); | ||||||
|  | 
 | ||||||
|  | old.setPhone_number2(data.getPhone_number2()); | ||||||
|  | 
 | ||||||
|  | old.setParagraph_field(data.getParagraph_field()); | ||||||
|  | 
 | ||||||
|  | old.setParagraph_field2(data.getParagraph_field2()); | ||||||
|  | 
 | ||||||
|  | old.setPassword_field(data.getPassword_field()); | ||||||
|  | 
 | ||||||
|  | old.setTextarea(data.getTextarea()); | ||||||
|  | 
 | ||||||
|  | old.setTextarea_field(data.getTextarea_field()); | ||||||
|  | 
 | ||||||
|  | old.setTextarea_field2(data.getTextarea_field2()); | ||||||
|  | 
 | ||||||
|  | final Basicp1 test = Repository.save(old); | ||||||
|  | 		data.setUpdatedBy(getUser().getUserId()); | ||||||
|  |   return test;}  | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |  public AppUser getUser() { | ||||||
|  | 		AppUser user = userService.getLoggedInUser(); | ||||||
|  | 		return user; | ||||||
|  | 
 | ||||||
|  | 	}} | ||||||
| @ -0,0 +1,154 @@ | |||||||
|  | package com.realnet.angulardatatype.Services; | ||||||
|  | import com.realnet.angulardatatype.Repository.Basicp2Repository; | ||||||
|  | import com.realnet.angulardatatype.Entity.Basicp2 | ||||||
|  | ;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 Basicp2Service { | ||||||
|  | @Autowired | ||||||
|  | private Basicp2Repository Repository; | ||||||
|  | 	@Autowired | ||||||
|  | 	private AppUserServiceImpl userService;  | ||||||
|  | @Autowired | ||||||
|  | 	private RealmService realmService; | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | public Basicp2 Savedata(Basicp2 data) { | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | data.setUser_id(getUser().getUserId()); | ||||||
|  | 		data.setUser_name(getUser().getFullName()); | ||||||
|  | 
 | ||||||
|  | 	data.setUpdatedBy(getUser().getUserId()); | ||||||
|  | 		data.setCreatedBy(getUser().getUserId()); | ||||||
|  | 		data.setAccountId(getUser().getAccount().getAccount_id()); | ||||||
|  | Basicp2 save = Repository.save(data); | ||||||
|  | 				return save;	 | ||||||
|  | 			} | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | //	get all with pagination | ||||||
|  | 	public Page<Basicp2> getAllWithPagination(Pageable page) { | ||||||
|  | 		return Repository.findAll( getUser().getUserId(),page); | ||||||
|  | 	}			 | ||||||
|  | public List<Basicp2> getdetails() {   | ||||||
|  | 		List<Realm> realm = realmService.findByUserId(getUser().getUserId()); | ||||||
|  | List<Basicp2> all = Repository.findAll(getUser().getUserId()); | ||||||
|  | 		 | ||||||
|  | 		return all ;		} | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | public Basicp2 getdetailsbyId(Integer id) { | ||||||
|  | 	return Repository.findById(id).get(); | ||||||
|  | 			} | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 	public void delete_by_id(Integer id) { | ||||||
|  |  Repository.deleteById(id); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | public Basicp2 update(Basicp2 data,Integer id) { | ||||||
|  | 	Basicp2 old = Repository.findById(id).get(); | ||||||
|  | old.setAbout(data.getAbout()); | ||||||
|  | 
 | ||||||
|  | old.setTextarea2(data.getTextarea2()); | ||||||
|  | 
 | ||||||
|  | old.setDate_field(data.getDate_field()); | ||||||
|  | 
 | ||||||
|  | old.setDate_field2(data.getDate_field2()); | ||||||
|  | 
 | ||||||
|  | old.setDatetime_field(data.getDatetime_field()); | ||||||
|  | 
 | ||||||
|  | old.setDatetime_field2(data.getDatetime_field2()); | ||||||
|  | 
 | ||||||
|  | old.setEmail_field(data.getEmail_field()); | ||||||
|  | 
 | ||||||
|  | old.setEmail_field2(data.getEmail_field2()); | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | final Basicp2 test = Repository.save(old); | ||||||
|  | 		data.setUpdatedBy(getUser().getUserId()); | ||||||
|  |   return test;}  | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |  public AppUser getUser() { | ||||||
|  | 		AppUser user = userService.getLoggedInUser(); | ||||||
|  | 		return user; | ||||||
|  | 
 | ||||||
|  | 	}} | ||||||
| @ -0,0 +1,174 @@ | |||||||
|  | package com.realnet.angulardatatype.Services; | ||||||
|  | import com.realnet.angulardatatype.Repository.Basicp3Repository; | ||||||
|  | import com.realnet.angulardatatype.Entity.Basicp3 | ||||||
|  | ;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 Basicp3Service { | ||||||
|  | @Autowired | ||||||
|  | private Basicp3Repository Repository; | ||||||
|  | 	@Autowired | ||||||
|  | 	private AppUserServiceImpl userService;  | ||||||
|  | @Autowired | ||||||
|  | 	private RealmService realmService; | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | @Autowired | ||||||
|  |  private SequenceService documentsequencsequenceService; | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | public Basicp3 Savedata(Basicp3 data) { | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | data.setDocumentsequenc (documentsequencsequenceService.GenerateSequence("ff")); | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 	data.setUpdatedBy(getUser().getUserId()); | ||||||
|  | 		data.setCreatedBy(getUser().getUserId()); | ||||||
|  | 		data.setAccountId(getUser().getAccount().getAccount_id()); | ||||||
|  | Basicp3 save = Repository.save(data); | ||||||
|  | 				return save;	 | ||||||
|  | 			} | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | //	get all with pagination | ||||||
|  | 	public Page<Basicp3> getAllWithPagination(Pageable page) { | ||||||
|  | 		return Repository.findAll( getUser().getUserId(),page); | ||||||
|  | 	}			 | ||||||
|  | public List<Basicp3> getdetails() {   | ||||||
|  | 		List<Realm> realm = realmService.findByUserId(getUser().getUserId()); | ||||||
|  | List<Basicp3> all = Repository.findAll(getUser().getUserId()); | ||||||
|  | 		 | ||||||
|  | 		return all ;		} | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | public Basicp3 getdetailsbyId(Integer id) { | ||||||
|  | 	return Repository.findById(id).get(); | ||||||
|  | 			} | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 	public void delete_by_id(Integer id) { | ||||||
|  |  Repository.deleteById(id); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | public Basicp3 update(Basicp3 data,Integer id) { | ||||||
|  | 	Basicp3 old = Repository.findById(id).get(); | ||||||
|  | old.setToggle_switch (data.getToggle_switch()); | ||||||
|  | 
 | ||||||
|  | old.setToggle_switch2 (data.getToggle_switch2()); | ||||||
|  | 
 | ||||||
|  | old.setUrl_field(data.getUrl_field()); | ||||||
|  | 
 | ||||||
|  | old.setUrl_field2(data.getUrl_field2()); | ||||||
|  | 
 | ||||||
|  | old.setDecimal_field(data.getDecimal_field()); | ||||||
|  | 
 | ||||||
|  | old.setDecimal_field2(data.getDecimal_field2()); | ||||||
|  | 
 | ||||||
|  | old.setPercentage_field(data.getPercentage_field()); | ||||||
|  | 
 | ||||||
|  | old.setPercentage_field2(data.getPercentage_field2()); | ||||||
|  | 
 | ||||||
|  | old.setDocumentsequenc(data.getDocumentsequenc()); | ||||||
|  | 
 | ||||||
|  | old.setRecaptcha(data.getRecaptcha()); | ||||||
|  | 
 | ||||||
|  | old.setRecaptcha2(data.getRecaptcha2()); | ||||||
|  | 
 | ||||||
|  | final Basicp3 test = Repository.save(old); | ||||||
|  | 		data.setUpdatedBy(getUser().getUserId()); | ||||||
|  |   return test;}  | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |  public AppUser getUser() { | ||||||
|  | 		AppUser user = userService.getLoggedInUser(); | ||||||
|  | 		return user; | ||||||
|  | 
 | ||||||
|  | 	}} | ||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user