build_app

This commit is contained in:
risadmin_prod 2025-03-29 06:04:24 +00:00
parent 4dd18386ac
commit 6cb6b41383
13 changed files with 26 additions and 1262 deletions

View File

@ -69,6 +69,9 @@ public class BuilderService {
executeDump(true);
// ADD OTHER SERVICE
addCustomMenu( "Testm", "Transcations");
addCustomMenu( "Child", "Transcations");

View File

@ -23,20 +23,6 @@ import com.realnet.forma.Services.TestmService ;
@ -61,20 +47,6 @@ public class TestmController {
@ -91,20 +63,6 @@ public class TestmController {
@ -163,20 +121,6 @@ public class TestmController {

View File

@ -18,20 +18,6 @@ import com.realnet.WhoColumn.Entity.Extension;
import com.realnet.forma.Entity.Child;
@Entity
@Data
public class Testm extends Extension {
@ -60,31 +46,5 @@ private String selectautotypename;
private String selectautomul;
@OneToOne( cascade=CascadeType.ALL)
private Child child;
private String bar_code;
private String qr_code;
private int numbera;
private int numberb;
private String calculatedadd;
}

View File

@ -32,20 +32,6 @@ import com.realnet.forma.Services.TestmService;
import org.springframework.stereotype.Service;
@Service
@ -71,20 +57,6 @@ private TestmRepository Repository;
public Testm Savedata(Testm data) {
@ -118,20 +90,6 @@ if (data.getSelectauto() != null) {
data.setUpdatedBy(getUser().getUserId());
data.setCreatedBy(getUser().getUserId());
data.setAccountId(getUser().getAccount().getAccount_id());
@ -177,29 +135,6 @@ old.setSelectauto(data.getSelectauto());
old.setSelectautomul(data.getSelectautomul());
old.setChild(data.getChild());
old.setBar_code(data.getBar_code());
old.setQr_code(data.getQr_code());
old.setNumbera(data.getNumbera());
old.setNumberb(data.getNumberb());
old.setCalculatedadd(data.getCalculatedadd());
final Testm test = Repository.save(old);
data.setUpdatedBy(getUser().getUserId());
return test;}
@ -210,20 +145,6 @@ final Testm test = Repository.save(old);

View File

@ -1,4 +1,2 @@
CREATE TABLE db.Testm(id BIGINT NOT NULL AUTO_INCREMENT, numberb int, numbera int, calculatedadd VARCHAR(400), selecdya int, selectdyamul VARCHAR(400), onetoone VARCHAR(400), selectmulsta VARCHAR(400), valuell VARCHAR(400), bar_code VARCHAR(400), dataggg VARCHAR(400), selectauto int, selectautomul VARCHAR(400), qr_code VARCHAR(400), namem VARCHAR(400), selectsta VARCHAR(400), PRIMARY KEY (id));
CREATE TABLE db.Child(id BIGINT NOT NULL AUTO_INCREMENT, namemmm VARCHAR(400), PRIMARY KEY (id));
CREATE TABLE db.Testm(id BIGINT NOT NULL AUTO_INCREMENT, selecdya int, selectdyamul VARCHAR(400), selectmulsta VARCHAR(400), selectauto int, selectautomul VARCHAR(400), namem VARCHAR(400), selectsta VARCHAR(400), PRIMARY KEY (id));

View File

@ -59,20 +59,6 @@ Future<List<Map<String, dynamic>>> getAllWithPagination(
@ -104,20 +90,6 @@ Future<List<Map<String, dynamic>>> getAllWithPagination(

View File

@ -42,20 +42,6 @@ import '../../../../Reuseable/reusable_dropdown_field.dart';
@ -259,254 +245,6 @@ if (element['namem'] != null)
}
}
Widget buildFormField(String fieldOption) {
return Padding(
padding: const EdgeInsets.only(bottom: 16.0),
child: Card(
elevation: 4,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8),
),
child: Padding(
padding: const EdgeInsets.all(12.0),
child: TextFormField(
decoration: InputDecoration(
labelText: fieldOption,
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(8),
),
),
onSaved: (value) {
if (formData['child'] == null) {
formData['child'] = {};
}
formData['child'][fieldOption] = value;
},
),
),
),
);
}
late Future<List<Map<String, dynamic>>> _valuelldataFuture; // Data from fetchData
Future<List<Map<String, dynamic>>> valuellfetchData() async {
final resp = await apiService.getEntities();
if (resp != null) {
return resp;
} else {
throw Exception('Failed to load data: ');
}
}
void showvaluellDialog(BuildContext context) {
showDialog(
context: context,
builder: (BuildContext context) {
return SingleChildScrollView(
child: AlertDialog(
title: const Text('Select a record'),
content: FutureBuilder<List<Map<String, dynamic>>>(
future: _valuelldataFuture,
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 List<String> columnsToShow = [
'namem',
];
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: columnsToShow
.map(
(key) => DataColumn(
label: Text(
key,
style: const TextStyle(
fontWeight: FontWeight.bold, fontSize: 16),
),
),
)
.toList(),
rows: snapshot.data!.map((item) {
return DataRow(
cells: columnsToShow.map((key) {
return DataCell(
Text(
item[key].toString(),
style: const TextStyle(fontSize: 14),
),
onTap: () {
setState(() {
namemController.text = item['namem'] ?? '';
// Add more fields as needed
});
Navigator.pop(context);
},
);
}).toList());
}).toList(),
),
);
}
},
),
actions: [
TextButton(
child: const Text('Close'),
onPressed: () {
Navigator.of(context).pop();
},
),
],
),
);
},
);
}
final TextEditingController fieldggController = TextEditingController();
final TextEditingController numberaController = TextEditingController();
final TextEditingController numberbController = TextEditingController();
String calculatedaddOperator = '+';
String calculatedaddresult = '';
final List<String> calculatedaddoperators = ['+', '-', '*', '/'];
void calculatecalculatedaddResult() {
int calculation;
switch (calculatedaddOperator) {
case '+':
calculation =
int.parse(numberaController.text) +
int.parse(numberbController.text) +
0;
break;
case '-':
calculation =
int.parse(numberaController.text) -
int.parse(numberbController.text) -
0;
break;
case '*':
calculation =
int.parse(numberaController.text) *
int.parse(numberbController.text) *
1;
break;
case '/':
if (
int.parse(numberaController.text)== 0 ||
int.parse(numberbController.text)== 0 ||
1 != 1) {
calculatedaddresult = 'Division by zero error';
return;
}
calculation = (
int.parse(numberaController.text) /
int.parse(numberbController.text) /
1).toInt();
break;
default:
calculation = 0;
}
setState(() {
calculatedaddresult = 'Result: $calculation';
});
}
late Future<List<Map<String, dynamic>>> _datagggdataFuture; // Data from fetchData
Future<List<Map<String, dynamic>>> datagggfetchData() async {
final provider =
Provider.of<TestmViewModelScreen>(context, listen: false);
final resp = await provider.getdatagggGrid();
if (resp != null) {
return resp;
} else {
throw Exception('Failed to load data: ');
}
}
@override
void initState() {
super.initState();
@ -534,22 +272,6 @@ final provider =
_valuelldataFuture = valuellfetchData(); // Initialize _dataFuture with the function
_datagggdataFuture = datagggfetchData(); // Initialize _dataFuture with the function
}
@ -584,27 +306,6 @@ final provider =
actions: [
IconButton(
icon: const Icon(Icons.grid_on),
onPressed: () {
showvaluellDialog(context);
},
),
],
),
body: SingleChildScrollView(
child: Padding(
@ -932,154 +633,6 @@ final provider =
),
),
Padding(
padding: const EdgeInsets.all(16.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const SizedBox(
height: 20,
child: Text(
'Child',
style: TextStyle(
fontSize: 18,
fontWeight: FontWeight.bold,
color: Colors.black,
),
),
),
const SizedBox(height: 16), // Add space between elements
buildFormField('namemmm'),
],
),
),
Container(
padding: EdgeInsets.all(16.0),
decoration: BoxDecoration(
color: Colors.grey[200],
borderRadius: BorderRadius.circular(8.0),
boxShadow: [
BoxShadow(
color: Colors.black.withOpacity(0.2),
spreadRadius: 2,
blurRadius: 4,
offset: Offset(0, 2),
),
],
),
child: Column(
children: [
Text(
"Fieldgg",
style: TextStyle(
fontSize: 18,
fontWeight: FontWeight.bold,
),
),
SizedBox(height: 16),
ReusableTextField(
onSaved:(value) => formData['bar_code'] = value ,
label:"Enter Bar_code",
// ValidationProperties
),
SizedBox(height: 16),
ReusableTextField(
onSaved:(value) => formData['qr_code'] = value ,
label:"Enter Qr_code",
// ValidationProperties
),
SizedBox(height: 16),
SizedBox(height: 16),
],
),
),
const SizedBox(height: 16),
ReusableTextField(
controller: numberaController,
onSaved:(value) => formData['numbera'] = value ,
label: "Enter Numbera",
keyboardType: TextInputType.number,
inputFormatters: [
FilteringTextInputFormatter.allow((RegExp(r'[0-9]'))),
],
// ValidationProperties
),
SizedBox(height: 16),
ReusableTextField(
controller: numberbController,
onSaved:(value) => formData['numberb'] = value ,
label: "Enter Numberb",
keyboardType: TextInputType.number,
inputFormatters: [
FilteringTextInputFormatter.allow((RegExp(r'[0-9]'))),
],
// ValidationProperties
),
SizedBox(height: 16),
const SizedBox(height: 8.0),
DropdownButtonFormField<String>(
value: calculatedaddOperator,
items: calculatedaddoperators.map((String operator) {
return DropdownMenuItem(
value: operator,
child: Text(operator),
);
}).toList(),
onChanged: (value) {
setState(() {
calculatedaddOperator = value!;
print(calculatedaddOperator.toString());
print("value-- $value");
});
},
decoration: const InputDecoration(labelText: 'Operator'),
),
const SizedBox(height: 20.0),
ElevatedButton(
onPressed: () {
if (_formKey.currentState!.validate()) {
_formKey.currentState?.save(); // Save the form fields
}
calculatecalculatedaddResult();
setState(() {
});
},
child: const Text('Calculate'),
),
const SizedBox(height: 20.0),
Text(calculatedaddresult,style: TextStyle(color: Colors.black),),
const SizedBox(width: 8),
CustomButton(
height: getVerticalSize(50),
@ -1096,20 +649,6 @@ SizedBox(height: 16),
@ -1129,20 +668,6 @@ SizedBox(height: 16),
@ -1188,66 +713,6 @@ SizedBox(height: 16),
SizedBox(height: 16),
FutureBuilder<List<Map<String, dynamic>>>(
future: _datagggdataFuture,
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

@ -56,20 +56,6 @@ class _testm_entity_list_screenState extends State<testm_entity_list_screen> {
@ -232,55 +218,7 @@ Future<void> fetchEntities() async {
entity['selectautomul'].toString().toLowerCase().contains(keyword.toLowerCase()) ||
entity['child'].toString().toLowerCase().contains(keyword.toLowerCase()) ||
entity['bar_code'].toString().toLowerCase().contains(keyword.toLowerCase()) ||
entity['qr_code'].toString().toLowerCase().contains(keyword.toLowerCase()) ||
entity['numbera'].toString().toLowerCase().contains(keyword.toLowerCase()) ||
entity['numberb'].toString().toLowerCase().contains(keyword.toLowerCase()) ||
entity['dataggg'].toString().toLowerCase().contains(keyword.toLowerCase())
entity['selectautomul'].toString().toLowerCase().contains(keyword.toLowerCase())
).toList();
@ -364,20 +302,6 @@ onTapArrowleft1(BuildContext context) {
@ -785,117 +709,6 @@ onTapArrowleft1(BuildContext context) {
),
),
Padding(
padding: getPadding(
top: 10,
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
"Bar_code : ",
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.left,
style: AppStyle.txtGilroyMedium16,
),
Text(
entity['bar_code'].toString() ?? 'No Bar_code Available',
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.left,
style: AppStyle.txtGilroyMedium16Bluegray900,
),
],
),
),
Padding(
padding: getPadding(
top: 10,
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
"Qr_code : ",
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.left,
style: AppStyle.txtGilroyMedium16,
),
Text(
entity['qr_code'].toString() ?? 'No Qr_code Available',
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.left,
style: AppStyle.txtGilroyMedium16Bluegray900,
),
],
),
),
Padding(
padding: getPadding(
top: 10,
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
"Numbera : ",
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.left,
style: AppStyle.txtGilroyMedium16,
),
Text(
entity['numbera'].toString() ?? 'No Numbera Available',
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.left,
style: AppStyle.txtGilroyMedium16Bluegray900,
),
],
),
),
Padding(
padding: getPadding(
top: 10,
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
"Numberb : ",
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.left,
style: AppStyle.txtGilroyMedium16,
),
Text(
entity['numberb'].toString() ?? 'No Numberb Available',
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.left,
style: AppStyle.txtGilroyMedium16Bluegray900,
),
],
),
),
],
),

View File

@ -229,52 +229,6 @@ if (element['namem'] != null)
}
}
Widget buildFormField(String fieldOption) {
return Padding(
padding: const EdgeInsets.only(bottom: 16.0),
child: Card(
elevation: 4,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8),
),
child: Padding(
padding: const EdgeInsets.all(12.0),
child: TextFormField(
initialValue: widget.entity['child'] != null &&
widget.entity['child'][fieldOption] != null
? widget.entity['child'][fieldOption]
: '',
decoration: InputDecoration(
labelText: fieldOption,
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(8),
),
),
onSaved: (value) {
if (widget.entity['child'] == null) {
widget.entity['child'] = {};
}
widget.entity['child'][fieldOption] = value;
},
),
),
),
);
}
@override
void initState() {
@ -326,20 +280,6 @@ if (selectautomulString != null) {
selectedselectautomulValue = selectautomulString.split(', ');
}
}
@ -367,20 +307,6 @@ selectedselectautomulValue = selectautomulString.split(', ');
@ -657,154 +583,6 @@ FutureBuilder<List<String>>(
),
Padding(
padding: const EdgeInsets.all(16.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const SizedBox(
height: 20,
child: Text(
'Child',
style: TextStyle(
fontSize: 18,
fontWeight: FontWeight.bold,
color: Colors.black,
),
),
),
const SizedBox(height: 16), // Add space between elements
buildFormField('namemmm'),
],
),
),
Padding(
padding: EdgeInsets.all(16),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
ElevatedButton(
onPressed: () {
// Save changes logic here
Navigator.pop(context);
// Implement API call to update data
},
child: Text('Save'),
),
],
),
),
Container(
padding: EdgeInsets.all(16.0),
decoration: BoxDecoration(
color: Colors.grey[200],
borderRadius: BorderRadius.circular(8.0),
boxShadow: [
BoxShadow(
color: Colors.black.withOpacity(0.2),
spreadRadius: 2,
blurRadius: 4,
offset: Offset(0, 2),
),
],
),
child: Column(
children: [
Text(
"Fieldgg",
style: TextStyle(
fontSize: 18,
fontWeight: FontWeight.bold,
),
),
SizedBox(height: 16),
SizedBox(height: 16),
TextFormField(
initialValue: widget.entity['bar_code'],
decoration: InputDecoration(
labelText: 'fieldgg bar_code',
),
onChanged: (value) {
setState(() {
widget.entity['bar_code'] = value;
});
},
),
SizedBox(height: 16),
TextFormField(
initialValue: widget.entity['qr_code'],
decoration: InputDecoration(
labelText: 'fieldgg qr_code',
),
onChanged: (value) {
setState(() {
widget.entity['qr_code'] = value;
});
},
),
SizedBox(height: 16),
],
),
),
const SizedBox(height: 16),
ReusableTextField(
initialValue: widget.entity['numbera'].toString(),
onSaved: (value) => widget.entity['numbera']= value,
label: "Enter Numbera",
keyboardType: TextInputType.number,
inputFormatters: [
FilteringTextInputFormatter.allow((RegExp(r'[0-9]'))),
],
validator: (value) {
if (value == null || value.isEmpty) {
return 'Please enter a number';
}
return null;
},
),
ReusableTextField(
initialValue: widget.entity['numberb'].toString(),
onSaved: (value) => widget.entity['numberb']= value,
label: "Enter Numberb",
keyboardType: TextInputType.number,
inputFormatters: [
FilteringTextInputFormatter.allow((RegExp(r'[0-9]'))),
],
validator: (value) {
if (value == null || value.isEmpty) {
return 'Please enter a number';
}
return null;
},
),
CustomButton(
height: getVerticalSize(50),
@ -821,20 +599,6 @@ const SizedBox(height: 16),
@ -855,20 +619,6 @@ const SizedBox(height: 16),

View File

@ -105,26 +105,4 @@ class TestmRepoScreen {
}
}
Future<dynamic> getdatagggGrid() async {
try {
String apiUrl = "$baseUrl/Testm";
final response = await _helper.getGetApiResponse(apiUrl);
return response;
} catch (e) {
throw Exception('Failed to Upload dataggg: $e');
}
}
}

View File

@ -168,33 +168,4 @@ List<Map<String, dynamic>> selectautomulItems = [];
}
}
late List<Map<String, dynamic>> datagggdataFuture =
[]; // Data from fetchData
Future<List<Map<String, dynamic>>> getdatagggGrid() async {
try {
final value = await repo.getdatagggGrid();
datagggdataFuture = (value as List)
.map((item) => item as Map<String, dynamic>)
.toList();
return datagggdataFuture;
} catch (e) {
throw Exception('Failed to get all: $e');
}
}
}

View File

@ -1,5 +1,6 @@
import '../../Entity/forma/Testm/TestmView/Testm_entity_list_screen.dart';
import '../../Entity/forma/Testm/Testm_viewModel/Testm_view_model_screen.dart';
import '../../Entity/forma/Testm/TestmView/Testm_entity_list_screen.dart';
import '../../Entity/forma/Testm/Testm_viewModel/Testm_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: 'Testm',
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => ChangeNotifierProvider(
create: (context) => TestmViewModelScreen(),
child: testm_entity_list_screen(),
),
),
);
},
),
DrawerItem(
color: AppColors.primary,
icon: Icons.chat_bubble,
title: 'Testm',
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => ChangeNotifierProvider(
create: (context) => TestmViewModelScreen(),
child: testm_entity_list_screen(),
),
),
);
},
),
DrawerItem(