build_app

This commit is contained in:
risadmin_prod 2025-03-31 06:12:30 +00:00
parent 864e283700
commit c920b47644
16 changed files with 267 additions and 20 deletions

View File

@ -55,6 +55,8 @@ Future<List<Map<String, dynamic>>> getAllWithPagination(
Future<void> updateEntity( int entityId, Map<String, dynamic> entity) async {
try {
@ -77,4 +79,6 @@ Future<List<Map<String, dynamic>>> getAllWithPagination(
}

View File

@ -39,6 +39,8 @@ import '../../../../Reuseable/reusable_dropdown_field.dart';
class testttCreateEntityScreen extends StatefulWidget {
const testttCreateEntityScreen({super.key});
@ -158,6 +160,22 @@ final List<String> columnsToShow = [
}
late Future<List<Map<String, dynamic>>> _datagdataFuture; // Data from fetchData
Future<List<Map<String, dynamic>>> datagfetchData() async {
final provider =
Provider.of<TestttViewModelScreen>(context, listen: false);
final resp = await provider.getdatagGrid();
if (resp != null) {
return resp;
} else {
throw Exception('Failed to load data: ');
}
}
@override
void initState() {
super.initState();
@ -167,6 +185,9 @@ final List<String> columnsToShow = [
_value_list_fielddataFuture = value_list_fieldfetchData(); // Initialize _dataFuture with the function
_datagdataFuture = datagfetchData(); // Initialize _dataFuture with the function
}
@ -224,6 +245,8 @@ Padding(
),
),
body: SingleChildScrollView(
child: Padding(
@ -245,6 +268,8 @@ Padding(
const SizedBox(width: 8),
CustomButton(
height: getVerticalSize(50),
@ -257,6 +282,8 @@ Padding(
try {
print(formData);
@ -265,6 +292,8 @@ Padding(
Navigator.pop(context);
@ -295,6 +324,54 @@ Padding(
SizedBox(height: 16),
FutureBuilder<List<Map<String, dynamic>>>(
future: _datagdataFuture,
builder: (context, snapshot) {
if (snapshot.connectionState == ConnectionState.waiting) {
return const Center(child: CircularProgressIndicator());
} else if (snapshot.hasError) {
return Center(child: Text('Error: ${snapshot.error}'));
} else if (!snapshot.hasData || snapshot.data!.isEmpty) {
return const Center(child: Text('No data available..'));
} else {
final keys = snapshot.data!.first.keys.toList();
return SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: DataTable(
columnSpacing: 30,
headingRowColor: MaterialStateColor.resolveWith((states) => Colors.blue.shade100),
dataRowColor: MaterialStateColor.resolveWith((states) => Colors.white),
dividerThickness: 0.5,
columns: keys.map(
(key) => DataColumn(
label: Text(
key,
style: const TextStyle(fontWeight: FontWeight.bold, fontSize: 16),
),
),
)
.toList(),
rows: snapshot.data!.map((item) {
return DataRow(cells: keys.map((key) {
return DataCell(
Text(
item[key].toString(),
style: const TextStyle(fontSize: 14),
),
);
}).toList());
}).toList(),
),
);
}
},
),
SizedBox(height: 16),
],
),
),

View File

@ -53,6 +53,8 @@ class _testtt_entity_list_screenState extends State<testtt_entity_list_screen> {
Future<void> fetchwithoutpaging() async {
try {
final provider =
@ -172,11 +174,17 @@ Future<void> fetchEntities() async {
entity['name'].toString().toLowerCase().contains(keyword.toLowerCase())
entity['name'].toString().toLowerCase().contains(keyword.toLowerCase()) ||
entity['datag'].toString().toLowerCase().contains(keyword.toLowerCase())
).toList();
});
}
@ -255,6 +263,8 @@ onTapArrowleft1(BuildContext context) {
],
), ],
),
@ -513,6 +523,8 @@ onTapArrowleft1(BuildContext context) {
],
),

View File

@ -40,6 +40,8 @@ class _testttUpdateEntityScreenState extends State<testttUpdateEntityScreen> {
@override
void initState() {
@ -49,6 +51,8 @@ class _testttUpdateEntityScreenState extends State<testttUpdateEntityScreen> {
}
@ -73,6 +77,8 @@ class _testttUpdateEntityScreenState extends State<testttUpdateEntityScreen> {
],
),
body: SingleChildScrollView(
@ -97,6 +103,8 @@ class _testttUpdateEntityScreenState extends State<testttUpdateEntityScreen> {
CustomButton(
height: getVerticalSize(50),
@ -109,6 +117,8 @@ class _testttUpdateEntityScreenState extends State<testttUpdateEntityScreen> {
try {
await provider.updateEntity(
@ -118,6 +128,8 @@ class _testttUpdateEntityScreenState extends State<testttUpdateEntityScreen> {
Navigator.pop(context);

View File

@ -63,4 +63,14 @@ class TestttRepoScreen {
Future<dynamic> getdatagGrid() async {
try {
String apiUrl = "$baseUrl/Testtt_ListFilter1/Testtt_ListFilter1";
final response = await _helper.getGetApiResponse(apiUrl);
return response;
} catch (e) {
throw Exception('Failed to Upload datag: $e');
}
}
}

View File

@ -102,4 +102,21 @@ class TestttViewModelScreen extends ChangeNotifier{
late List<Map<String, dynamic>> datagdataFuture =
[]; // Data from fetchData
Future<List<Map<String, dynamic>>> getdatagGrid() async {
try {
final value = await repo.getdatagGrid();
datagdataFuture = (value as List)
.map((item) => item as Map<String, dynamic>)
.toList();
return datagdataFuture;
} catch (e) {
throw Exception('Failed to get all: $e');
}
}
}

View File

@ -1,5 +1,6 @@
import '../../Entity/forma/Testtt/TestttView/Testtt_entity_list_screen.dart';
import '../../Entity/forma/Testtt/Testtt_viewModel/Testtt_view_model_screen.dart';
import '../../Entity/forma/Testtt/TestttView/Testtt_entity_list_screen.dart';
import '../../Entity/forma/Testtt/Testtt_viewModel/Testtt_view_model_screen.dart';
import 'package:base_project/utils/image_constant.dart';
import 'package:base_project/commans/widgets/custome_drawe_item.dart';
@ -73,22 +74,24 @@ Navigator.pushNamed(context, RouteNames.changePasswordView);
),
// NEW MENU
DrawerItem(
color: AppColors.primary,
icon: Icons.chat_bubble,
title: 'Testtt',
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => ChangeNotifierProvider(
create: (context) => TestttViewModelScreen(),
child: testtt_entity_list_screen(),
),
),
);
},
),
DrawerItem(
color: AppColors.primary,
icon: Icons.chat_bubble,
title: 'Testtt',
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => ChangeNotifierProvider(
create: (context) => TestttViewModelScreen(),
child: testtt_entity_list_screen(),
),
),
);
},
),
DrawerItem(

View File

@ -72,6 +72,9 @@ public class BuilderService {
addCustomMenu( "Testtt", "Transcations");
addCustomMenu( "Testtt", "Transcations");
System.out.println("dashboard and menu inserted...");

View File

@ -20,6 +20,8 @@ import com.realnet.forma.Services.TestttService ;
@RequestMapping(value = "/Testtt")
@CrossOrigin("*")
@RestController
@ -34,12 +36,16 @@ public class TestttController {
@PostMapping("/Testtt")
public Testtt Savedata(@RequestBody Testtt data) {
Testtt save = Service.Savedata(data) ;
System.out.println("data saved..." + save);
return save;
@ -88,4 +94,6 @@ public class TestttController {
}

View File

@ -0,0 +1,24 @@
package com.realnet.forma.Controllers;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.realnet.forma.Entity.Testtt_ListFilter1;
import com.realnet.forma.Services.Testtt_ListFilter1Service ;
@RequestMapping(value = "/Testtt_ListFilter1")
@RestController
public class Testtt_ListFilter1Controller {
@Autowired
private Testtt_ListFilter1Service Service;
@GetMapping("/Testtt_ListFilter1")
public List<Testtt_ListFilter1> getlist() {
List<Testtt_ListFilter1> get = Service.getlistbuilder();
return get;
}
@GetMapping("/Testtt_ListFilter11")
public List<Testtt_ListFilter1> getlistwithparam( ) {
List<Testtt_ListFilter1> get = Service.getlistbuilderparam( );
return get;
}
}

View File

@ -8,6 +8,8 @@ import com.realnet.WhoColumn.Entity.Extension;
@Entity
@Data
public class Testtt extends Extension {
@ -25,4 +27,6 @@ private String name;
}

View File

@ -0,0 +1,14 @@
package com.realnet.forma.Entity;
import lombok.*;
import javax.persistence.*;
import java.time.LocalDateTime;
import java.util.*;
@Data
public class Testtt_ListFilter1 {
private Integer id;
private String name;
}

View File

@ -16,6 +16,8 @@ import com.realnet.users.entity1.AppUser;
import org.springframework.stereotype.Service;
@Service
@ -29,11 +31,15 @@ private TestttRepository Repository;
public Testtt Savedata(Testtt data) {
data.setUpdatedBy(getUser().getUserId());
data.setCreatedBy(getUser().getUserId());
data.setAccountId(getUser().getAccount().getAccount_id());
@ -69,6 +75,8 @@ old.setName(data.getName());
final Testtt test = Repository.save(old);
data.setUpdatedBy(getUser().getUserId());
return test;}
@ -76,6 +84,8 @@ final Testtt test = Repository.save(old);
public AppUser getUser() {
AppUser user = userService.getLoggedInUser();
return user;

View File

@ -0,0 +1,47 @@
package com.realnet.forma.Services;
import java.util.*;
import com.realnet.forma.Repository.TestttRepository;
import com.realnet.forma.Entity.Testtt;
import com.realnet.forma.Entity.Testtt_ListFilter1;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Service
public class Testtt_ListFilter1Service {
@Autowired
private TestttRepository Repository;
public List<Testtt_ListFilter1> getlistbuilder() {
List<Testtt> list= Repository.findAll();
ArrayList<Testtt_ListFilter1> l = new ArrayList<>();
for (Testtt data : list) {
{
Testtt_ListFilter1 dummy = new Testtt_ListFilter1();
dummy.setId(data.getId());
dummy.setName(data.getName());
l.add(dummy);
}
}
return l;}
public List<Testtt_ListFilter1> getlistbuilderparam( ) {
List<Testtt> list= Repository.findAll();
ArrayList<Testtt_ListFilter1> l = new ArrayList<>();
for (Testtt data : list) {
{
Testtt_ListFilter1 dummy = new Testtt_ListFilter1();
dummy.setId(data.getId());
dummy.setName(data.getName());
l.add(dummy);
}
}
return l;}
}

View File

@ -1,2 +1,2 @@
CREATE TABLE testdb.Testtt(id BIGINT NOT NULL AUTO_INCREMENT, value_list_field VARCHAR(400), name VARCHAR(400), PRIMARY KEY (id));
CREATE TABLE testdb.Testtt(id BIGINT NOT NULL AUTO_INCREMENT, datag VARCHAR(400), value_list_field VARCHAR(400), name VARCHAR(400), PRIMARY KEY (id));