build_app
This commit is contained in:
parent
864e283700
commit
c920b47644
@ -55,6 +55,8 @@ Future<List<Map<String, dynamic>>> getAllWithPagination(
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Future<void> updateEntity( int entityId, Map<String, dynamic> entity) async {
|
Future<void> updateEntity( int entityId, Map<String, dynamic> entity) async {
|
||||||
try {
|
try {
|
||||||
@ -77,4 +79,6 @@ Future<List<Map<String, dynamic>>> getAllWithPagination(
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -39,6 +39,8 @@ import '../../../../Reuseable/reusable_dropdown_field.dart';
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class testttCreateEntityScreen extends StatefulWidget {
|
class testttCreateEntityScreen extends StatefulWidget {
|
||||||
const testttCreateEntityScreen({super.key});
|
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
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
@ -167,6 +185,9 @@ final List<String> columnsToShow = [
|
|||||||
_value_list_fielddataFuture = value_list_fieldfetchData(); // Initialize _dataFuture with the function
|
_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(
|
body: SingleChildScrollView(
|
||||||
child: Padding(
|
child: Padding(
|
||||||
@ -245,6 +268,8 @@ Padding(
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const SizedBox(width: 8),
|
const SizedBox(width: 8),
|
||||||
CustomButton(
|
CustomButton(
|
||||||
height: getVerticalSize(50),
|
height: getVerticalSize(50),
|
||||||
@ -257,6 +282,8 @@ Padding(
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
print(formData);
|
print(formData);
|
||||||
@ -265,6 +292,8 @@ Padding(
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Navigator.pop(context);
|
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),
|
||||||
|
|
||||||
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
@ -53,6 +53,8 @@ class _testtt_entity_list_screenState extends State<testtt_entity_list_screen> {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Future<void> fetchwithoutpaging() async {
|
Future<void> fetchwithoutpaging() async {
|
||||||
try {
|
try {
|
||||||
final provider =
|
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();
|
).toList();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -255,6 +263,8 @@ onTapArrowleft1(BuildContext context) {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
],
|
],
|
||||||
), ],
|
), ],
|
||||||
),
|
),
|
||||||
@ -513,6 +523,8 @@ onTapArrowleft1(BuildContext context) {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|||||||
@ -40,6 +40,8 @@ class _testttUpdateEntityScreenState extends State<testttUpdateEntityScreen> {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
@ -49,6 +51,8 @@ class _testttUpdateEntityScreenState extends State<testttUpdateEntityScreen> {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -73,6 +77,8 @@ class _testttUpdateEntityScreenState extends State<testttUpdateEntityScreen> {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
body: SingleChildScrollView(
|
body: SingleChildScrollView(
|
||||||
@ -97,6 +103,8 @@ class _testttUpdateEntityScreenState extends State<testttUpdateEntityScreen> {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
CustomButton(
|
CustomButton(
|
||||||
height: getVerticalSize(50),
|
height: getVerticalSize(50),
|
||||||
@ -109,6 +117,8 @@ class _testttUpdateEntityScreenState extends State<testttUpdateEntityScreen> {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await provider.updateEntity(
|
await provider.updateEntity(
|
||||||
@ -118,6 +128,8 @@ class _testttUpdateEntityScreenState extends State<testttUpdateEntityScreen> {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Navigator.pop(context);
|
Navigator.pop(context);
|
||||||
|
|||||||
@ -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');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -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/utils/image_constant.dart';
|
||||||
import 'package:base_project/commans/widgets/custome_drawe_item.dart';
|
import 'package:base_project/commans/widgets/custome_drawe_item.dart';
|
||||||
@ -73,22 +74,24 @@ Navigator.pushNamed(context, RouteNames.changePasswordView);
|
|||||||
),
|
),
|
||||||
|
|
||||||
// NEW MENU
|
// NEW MENU
|
||||||
DrawerItem(
|
|
||||||
color: AppColors.primary,
|
|
||||||
icon: Icons.chat_bubble,
|
DrawerItem(
|
||||||
title: 'Testtt',
|
color: AppColors.primary,
|
||||||
onTap: () {
|
icon: Icons.chat_bubble,
|
||||||
Navigator.push(
|
title: 'Testtt',
|
||||||
context,
|
onTap: () {
|
||||||
MaterialPageRoute(
|
Navigator.push(
|
||||||
builder: (context) => ChangeNotifierProvider(
|
context,
|
||||||
create: (context) => TestttViewModelScreen(),
|
MaterialPageRoute(
|
||||||
child: testtt_entity_list_screen(),
|
builder: (context) => ChangeNotifierProvider(
|
||||||
),
|
create: (context) => TestttViewModelScreen(),
|
||||||
),
|
child: testtt_entity_list_screen(),
|
||||||
);
|
),
|
||||||
},
|
),
|
||||||
),
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
|
||||||
|
|
||||||
DrawerItem(
|
DrawerItem(
|
||||||
|
|||||||
@ -72,6 +72,9 @@ public class BuilderService {
|
|||||||
addCustomMenu( "Testtt", "Transcations");
|
addCustomMenu( "Testtt", "Transcations");
|
||||||
|
|
||||||
|
|
||||||
|
addCustomMenu( "Testtt", "Transcations");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
System.out.println("dashboard and menu inserted...");
|
System.out.println("dashboard and menu inserted...");
|
||||||
|
|
||||||
|
|||||||
@ -20,6 +20,8 @@ import com.realnet.forma.Services.TestttService ;
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@RequestMapping(value = "/Testtt")
|
@RequestMapping(value = "/Testtt")
|
||||||
@CrossOrigin("*")
|
@CrossOrigin("*")
|
||||||
@RestController
|
@RestController
|
||||||
@ -34,12 +36,16 @@ public class TestttController {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@PostMapping("/Testtt")
|
@PostMapping("/Testtt")
|
||||||
public Testtt Savedata(@RequestBody Testtt data) {
|
public Testtt Savedata(@RequestBody Testtt data) {
|
||||||
Testtt save = Service.Savedata(data) ;
|
Testtt save = Service.Savedata(data) ;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
System.out.println("data saved..." + save);
|
System.out.println("data saved..." + save);
|
||||||
|
|
||||||
return save;
|
return save;
|
||||||
@ -88,4 +94,6 @@ public class TestttController {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -8,6 +8,8 @@ import com.realnet.WhoColumn.Entity.Extension;
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
@Data
|
@Data
|
||||||
public class Testtt extends Extension {
|
public class Testtt extends Extension {
|
||||||
@ -25,4 +27,6 @@ private String name;
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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;
|
||||||
|
}
|
||||||
@ -12,6 +12,8 @@ import java.util.*;
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -16,6 +16,8 @@ import com.realnet.users.entity1.AppUser;
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
@ -29,11 +31,15 @@ private TestttRepository Repository;
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public Testtt Savedata(Testtt data) {
|
public Testtt Savedata(Testtt data) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
data.setUpdatedBy(getUser().getUserId());
|
data.setUpdatedBy(getUser().getUserId());
|
||||||
data.setCreatedBy(getUser().getUserId());
|
data.setCreatedBy(getUser().getUserId());
|
||||||
data.setAccountId(getUser().getAccount().getAccount_id());
|
data.setAccountId(getUser().getAccount().getAccount_id());
|
||||||
@ -69,6 +75,8 @@ old.setName(data.getName());
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
final Testtt test = Repository.save(old);
|
final Testtt test = Repository.save(old);
|
||||||
data.setUpdatedBy(getUser().getUserId());
|
data.setUpdatedBy(getUser().getUserId());
|
||||||
return test;}
|
return test;}
|
||||||
@ -76,6 +84,8 @@ final Testtt test = Repository.save(old);
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public AppUser getUser() {
|
public AppUser getUser() {
|
||||||
AppUser user = userService.getLoggedInUser();
|
AppUser user = userService.getLoggedInUser();
|
||||||
return user;
|
return user;
|
||||||
|
|||||||
@ -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;}
|
||||||
|
}
|
||||||
@ -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));
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user