build_app

This commit is contained in:
risadmin_prod 2025-03-29 09:29:40 +00:00
parent 8a1b32b7e2
commit b5e96d3c04
16 changed files with 2680 additions and 122 deletions

View File

@ -72,6 +72,12 @@ public class BuilderService {
addCustomMenu( "Child", "Transcations");
addCustomMenu( "Testm", "Transcations");
addCustomMenu( "Child", "Transcations");
addCustomMenu( "Testm", "Transcations");

View File

@ -20,6 +20,28 @@ import com.realnet.forma.Services.TestmService ;
@RequestMapping(value = "/Testm")
@CrossOrigin("*")
@RestController
@ -34,12 +56,56 @@ public class TestmController {
@PostMapping("/Testm")
public Testm Savedata(@RequestBody Testm data) {
Testm save = Service.Savedata(data) ;
System.out.println("data saved..." + save);
return save;
@ -88,4 +154,26 @@ public class TestmController {
}

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.Testm_ListFilter1;
import com.realnet.forma.Services.Testm_ListFilter1Service ;
@RequestMapping(value = "/Testm_ListFilter1")
@RestController
public class Testm_ListFilter1Controller {
@Autowired
private Testm_ListFilter1Service Service;
@GetMapping("/Testm_ListFilter1")
public List<Testm_ListFilter1> getlist() {
List<Testm_ListFilter1> get = Service.getlistbuilder();
return get;
}
@GetMapping("/Testm_ListFilter11")
public List<Testm_ListFilter1> getlistwithparam( ) {
List<Testm_ListFilter1> get = Service.getlistbuilderparam( );
return get;
}
}

View File

@ -6,7 +6,29 @@ import com.realnet.WhoColumn.Entity.Extension;
import java.util.*;
import com.realnet.forma.Entity.Child;
@Entity
@Data
@ -22,8 +44,42 @@ import com.realnet.forma.Entity.Child;
private String namem;
@OneToOne( cascade=CascadeType.ALL)
private Child child;
private String selectsta;
private String selectstamul;
private Integer selectdya;
private String selectdyaname;
private String selectdyamul;
private Integer selectauto;
private String selectautotypename;
private String selectautomul;
private String bar_code;
private String qr_code;
private int numbers;
private int numberk;
private String calculateadd;
}

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 Testm_ListFilter1 {
private Integer id;
private String namem;
}

View File

@ -16,6 +16,34 @@ import com.realnet.users.entity1.AppUser;
import com.realnet.forma.Entity.Testm;
import com.realnet.forma.Services.TestmService;
import com.realnet.forma.Entity.Testm;
import com.realnet.forma.Services.TestmService;
import org.springframework.stereotype.Service;
@Service
@ -29,11 +57,75 @@ private TestmRepository Repository;
@Autowired
private TestmService selectdyaserv;
@Autowired
private TestmService selectautoserv;
public Testm Savedata(Testm data) {
if (data.getSelectdya() != null) {
Testm get = selectdyaserv.getdetailsbyId(data.getSelectdya());
data.setSelectdyaname(get.getNamem());
}
if (data.getSelectauto() != null) {
Testm get = selectautoserv.getdetailsbyId(data.getSelectauto());
data.setSelectautotypename(get.getNamem());
}
data.setUpdatedBy(getUser().getUserId());
data.setCreatedBy(getUser().getUserId());
data.setAccountId(getUser().getAccount().getAccount_id());
@ -67,7 +159,38 @@ public Testm update(Testm data,Integer id) {
Testm old = Repository.findById(id).get();
old.setNamem(data.getNamem());
old.setChild(data.getChild());
old.setSelectsta(data.getSelectsta());
old.setSelectstamul(data.getSelectstamul());
old.setSelectdya(data.getSelectdya());
old.setSelectdyamul(data.getSelectdyamul());
old.setSelectauto(data.getSelectauto());
old.setSelectautomul(data.getSelectautomul());
old.setBar_code(data.getBar_code());
old.setQr_code(data.getQr_code());
old.setNumbers(data.getNumbers());
old.setNumberk(data.getNumberk());
old.setCalculateadd(data.getCalculateadd());
final Testm test = Repository.save(old);
data.setUpdatedBy(getUser().getUserId());
@ -76,6 +199,28 @@ final Testm 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.TestmRepository;
import com.realnet.forma.Entity.Testm;
import com.realnet.forma.Entity.Testm_ListFilter1;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Service
public class Testm_ListFilter1Service {
@Autowired
private TestmRepository Repository;
public List<Testm_ListFilter1> getlistbuilder() {
List<Testm> list= Repository.findAll();
ArrayList<Testm_ListFilter1> l = new ArrayList<>();
for (Testm data : list) {
{
Testm_ListFilter1 dummy = new Testm_ListFilter1();
dummy.setId(data.getId());
dummy.setNamem(data.getNamem());
l.add(dummy);
}
}
return l;}
public List<Testm_ListFilter1> getlistbuilderparam( ) {
List<Testm> list= Repository.findAll();
ArrayList<Testm_ListFilter1> l = new ArrayList<>();
for (Testm data : list) {
{
Testm_ListFilter1 dummy = new Testm_ListFilter1();
dummy.setId(data.getId());
dummy.setNamem(data.getNamem());
l.add(dummy);
}
}
return l;}
}

View File

@ -1,4 +1,4 @@
CREATE TABLE db.Testm(id BIGINT NOT NULL AUTO_INCREMENT, onetoone VARCHAR(400), namem VARCHAR(400), PRIMARY KEY (id));
CREATE TABLE db.Testm(id BIGINT NOT NULL AUTO_INCREMENT, selectdya int, numbers int, selectdyamul VARCHAR(400), calculateadd VARCHAR(400), valuell VARCHAR(400), selectstamul VARCHAR(400), bar_code VARCHAR(400), selectauto int, selectautomul VARCHAR(400), qr_code VARCHAR(400), numberk int, namem VARCHAR(400), datagg VARCHAR(400), selectsta VARCHAR(400), PRIMARY KEY (id));
CREATE TABLE db.Child(id BIGINT NOT NULL AUTO_INCREMENT, namemmm VARCHAR(400), PRIMARY KEY (id));

View File

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

View File

@ -53,6 +53,28 @@ class _testm_entity_list_screenState extends State<testm_entity_list_screen> {
Future<void> fetchwithoutpaging() async {
try {
final provider =
@ -178,7 +200,79 @@ Future<void> fetchEntities() async {
entity['child'].toString().toLowerCase().contains(keyword.toLowerCase())
entity['selectsta'].toString().toLowerCase().contains(keyword.toLowerCase()) ||
entity['selectstamul'].toString().toLowerCase().contains(keyword.toLowerCase()) ||
entity['selectdya'].toString().toLowerCase().contains(keyword.toLowerCase()) ||
entity['selectdyamul'].toString().toLowerCase().contains(keyword.toLowerCase()) ||
entity['selectautotypename'].toString().toLowerCase().contains(keyword.toLowerCase()) ||
entity['selectautomul'].toString().toLowerCase().contains(keyword.toLowerCase()) ||
entity['bar_code'].toString().toLowerCase().contains(keyword.toLowerCase()) ||
entity['qr_code'].toString().toLowerCase().contains(keyword.toLowerCase()) ||
entity['datagg'].toString().toLowerCase().contains(keyword.toLowerCase()) ||
entity['numbers'].toString().toLowerCase().contains(keyword.toLowerCase()) ||
entity['numberk'].toString().toLowerCase().contains(keyword.toLowerCase())
).toList();
@ -259,6 +353,28 @@ onTapArrowleft1(BuildContext context) {
],
), ],
),
@ -516,6 +632,255 @@ onTapArrowleft1(BuildContext context) {
),
Padding(
padding: getPadding(
top: 10,
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
"selectsta : ",
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.left,
style: AppStyle.txtGilroyMedium16,
),
Text(
entity['selectsta'].toString() ?? 'No selectsta Available',
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.left,
style: AppStyle.txtGilroyMedium16Bluegray900,
),
],
),
),
Padding(
padding: getPadding(
top: 10,
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
"selectstamul : ",
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.left,
style: AppStyle.txtGilroyMedium16,
),
Text(
entity['selectstamul'].toString() ?? 'No selectstamul Available',
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.left,
style: AppStyle.txtGilroyMedium16Bluegray900,
),
],
),
),
Padding(
padding: getPadding(
top: 10,
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
"selectdya : ",
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.left,
style: AppStyle.txtGilroyMedium16,
),
Text(
entity['selectdya'].toString() ?? 'No selectdya Available',
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.left,
style: AppStyle.txtGilroyMedium16Bluegray900,
),
],
),
),
Padding(
padding: getPadding(
top: 10,
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
"selectdyamul : ",
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.left,
style: AppStyle.txtGilroyMedium16,
),
Text(
entity['selectdyamul'].toString() ?? 'No selectdyamul Available',
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.left,
style: AppStyle.txtGilroyMedium16Bluegray900,
),
],
),
),
Padding(
padding: getPadding(
top: 10,
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
"selectauto : ",
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.left,
style: AppStyle.txtGilroyMedium16,
),
Text(
entity['selectautotypename'] ?? 'No selectauto Available',
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.left,
style: AppStyle.txtGilroyMedium16Bluegray900,
),
],
),
),
Padding(
padding: getPadding(
top: 10,
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
"selectautomul : ",
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.left,
style: AppStyle.txtGilroyMedium16,
),
Text(
entity['selectautomul'].toString() ?? 'No selectautomul Available',
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.left,
style: AppStyle.txtGilroyMedium16Bluegray900,
),
],
),
),
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(
"Numbers : ",
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.left,
style: AppStyle.txtGilroyMedium16,
),
Text(
entity['numbers'].toString() ?? 'No Numbers Available',
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.left,
style: AppStyle.txtGilroyMedium16Bluegray900,
),
],
),
),
Padding(
padding: getPadding(
top: 10,
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
"Numberk : ",
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.left,
style: AppStyle.txtGilroyMedium16,
),
Text(
entity['numberk'].toString() ?? 'No Numberk Available',
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.left,
style: AppStyle.txtGilroyMedium16Bluegray900,
),
],
),
),

View File

@ -38,39 +38,203 @@ class _testmUpdateEntityScreenState extends State<testmUpdateEntityScreen> {
Widget buildFormField(String fieldOption) {
var selectedselectsta; // Initialize with the default value \n);
List<String> selectstaList = [
'q',
'b',
];
Widget _buildDropdownselectsta(String label, List<String> options, String? value, void Function(String?) onChanged) {
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;
},
),
),
),
);
padding: const EdgeInsets.symmetric(vertical: 8.0),
child: DropdownButtonFormField<String>(
decoration: InputDecoration(labelText: label,
border: OutlineInputBorder(),
),
value: value,
onChanged: onChanged,
items: options.map<DropdownMenuItem<String>>((String value) {
return DropdownMenuItem<String>(
value: value,
child: Text(value),
);
}).toList(),
),
);
}
List<dynamic> selectedselectstamul = [];
List<String> selectstamulList = [
'q',
'b',
'c',
];
Widget _buildDropdownselectstamul(
String label,
List<String> options,
String? selectedValue,
String fieldName,
void Function(String?) onChanged,
) {
return Padding(
padding: const EdgeInsets.symmetric(vertical: 8.0),
child: DropdownButtonFormField<String>(
decoration: InputDecoration(
labelText: label,
border: OutlineInputBorder(),
),
value: selectedValue,
items: options.map((String option) {
return DropdownMenuItem<String>(
value: option,
child: Text(option),
);
}).toList(),
onChanged: onChanged,
onSaved: (value) {
// Save selected value to entity or form data
widget.entity['selectstamul'] = value;
},
),
);
}
List<Map<String, dynamic>> selectdyaItems = [];
var selectedselectdyaValue;
List<String> selectdyamulItems = [];
List<String> selectedselectdyamulValue = [];
TextEditingController selectdyamulController = TextEditingController();
GlobalKey<AutoCompleteTextFieldState<String>> selectdyamulkey = GlobalKey();
Future<List<String>> _loadselectdyamulItems() async {
final provider =
Provider.of<TestmViewModelScreen>(context, listen: false);
try {
final selectTdata = await provider.getselectdyamul();
print('selectdyamul data is : $selectTdata');
if (selectTdata != null && selectTdata.isNotEmpty) {
List<String> datareturned = [];
selectTdata.forEach((element) {
if (element['namem'] != null)
datareturned.add(element['namem']);
});
return datareturned;
} else {
print('selectdyamul data is null or empty');
return [];
}
} catch (e) {
print('Failed to load selectdyamul items: $e');
return [];
}
}
List<Map<String, dynamic>> selectautoItems = [];
int? selectedselectautoId; // to store selected state id
String selectedselectautoValue = ''; // Use nullable type Future<void> _load
TextEditingController selectautoController = TextEditingController();
GlobalKey<AutoCompleteTextFieldState<String>> selectautokey = GlobalKey();
Future<List<Map<String, dynamic>>> _loadselectautoItems() async {
final provider =
Provider.of<TestmViewModelScreen>(context, listen: false);
try {
final selectTdata = await provider.getselectauto();
print('selectauto data is : $selectTdata');
if (selectTdata != null && selectTdata.isNotEmpty) {
selectautoItems = selectTdata;
print('data ret $selectautoItems');
return selectautoItems;
} else {
print('selectauto data is null or empty');
return [];
}
} catch (e) {
print('Failed to load selectauto items: $e');
return [];
}
}
List<String> selectautomulItems = [];
List<String> selectedselectautomulValue = [];
TextEditingController selectautomulController = TextEditingController();
GlobalKey<AutoCompleteTextFieldState<String>> selectautomulkey = GlobalKey();
Future<List<String>> _loadselectautomulItems() async {
final provider =
Provider.of<TestmViewModelScreen>(context, listen: false);
try {
final selectTdata = await provider.getselectautomul();
print('selectautomul data is : $selectTdata');
if (selectTdata != null && selectTdata.isNotEmpty) {
List<String> datareturned = [];
selectTdata.forEach((element) {
if (element['namem'] != null)
datareturned.add(element['namem']);
});
return datareturned;
} else {
print('selectautomul data is null or empty');
return [];
}
} catch (e) {
print('Failed to load selectautomul items: $e');
return [];
}
}
@override
@ -79,6 +243,60 @@ onSaved: (value) {
final provider = Provider.of<TestmViewModelScreen>(context, listen: false);
selectedselectsta = widget.entity['selectsta'] ?? selectstaList[0] ; // Initialize with the default value
print(json.decode(widget.entity['selectstamul'])['selectstamul'].toString());
selectedselectstamul= json.decode(widget.entity['selectstamul'])['selectstamul'];
print('selected selectstamulis ... $selectedselectstamul');
provider.getselectdya().then((value) {
setState(() {
selectdyaItems = value; // Update list only when data is fetched
selectedselectdyaValue = widget.entity['selectdya'] ?? null;
// Fetch the stored ID and convert it to a String
var entityValue = widget.entity['selectdya'];
if (entityValue != null) {
selectedselectdyaValue = entityValue.toString();
} else {
selectedselectdyaValue = null;
}
});
print('Updated selectdyaItems: $selectdyaItems');
print('Selected Value: $selectedselectdyaValue');
}).catchError((error) {
print('Error fetching data: $error');
});
String? selectdyamulString = widget.entity['selectdyamul'];
if (selectdyamulString != null) {
selectdyamulString = selectdyamulString.substring(0, selectdyamulString.length);
selectedselectdyamulValue = selectdyamulString.split(', ');
}
selectedselectautoValue = widget.entity['selectautoname']?? 'no data' ;
String? selectautomulString = widget.entity['selectautomul'];
if (selectautomulString != null) {
selectautomulString = selectautomulString.substring(0, selectautomulString.length );
selectedselectautomulValue = selectautomulString.split(', ');
}
}
@ -105,6 +323,28 @@ onSaved: (value) {
],
),
body: SingleChildScrollView(
@ -127,32 +367,373 @@ onSaved: (value) {
SizedBox(height: 16),
Padding(
padding: const EdgeInsets.all(16.0),
child: Column(
_buildDropdownselectsta(
'selectsta',
selectstaList,
selectedselectsta,
(value) {
setState(() {
selectedselectsta = value;
widget.entity['selectsta'] = value; // Save selected value to entity
});
},
),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
_buildDropdownselectstamul(
'Select selectstamul',
selectstamulList,
widget.entity['selectstamul'], // Use entity for initial values
'fieldName', // fieldName used to identify the value in state
(value) {
setState(() {
widget.entity['selectstamul'] = value; // Save selected values to entity
});
},
),
SizedBox(height: 16),
ElevatedButton(
onPressed: () {
// Handle save/update logic
print('Updated values: ${widget.entity['selectstamul']}');
},
child: Text('Save'),
),
],
),
ReusableDropdownField(
label: "Select dynmi",
options: selectdyaItems, // Your dynamic list
valueField: 'id', // API response key for ID
uiField: 'namem', // API response key for Name
value: selectedselectdyaValue,
onChanged: (newValue) {
setState(() {
selectedselectdyaValue = newValue!;
});
},
onSaved: (newValue) {
widget.entity['selectdya'] = selectedselectdyaValue?.isEmpty ?? true
? 'no value'
: newValue!;
},
),
const SizedBox(width: 16),
FutureBuilder<List<String>>(
future: _loadselectdyamulItems(),
builder: (context, AsyncSnapshot<List<String>> snapshot) {
if (snapshot.connectionState == ConnectionState.done) {
final selectdyamulItems = snapshot.data ?? [];
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const SizedBox(
height: 20,
child: Text(
'Child',
style: TextStyle(
fontSize: 18,
fontWeight: FontWeight.bold,
color: Colors.black,
),
),
Autocomplete<String>(
optionsBuilder: (TextEditingValue textEditingValue) {
if (textEditingValue.text.isEmpty) {
return const Iterable<String>.empty();
} else {
List<String> matches = <String>[];
matches.addAll(selectdyamulItems);
matches.retainWhere((s) =>
s.toLowerCase().contains(textEditingValue.text.toLowerCase()));
return matches;
}
},
onSelected: (String selection) {
setState(() {
if (selectedselectdyamulValue.contains(selection)) {
selectedselectdyamulValue.remove(selection);
} else {
selectedselectdyamulValue.add(selection);
}
widget.entity['selectdyamul'] = selectedselectdyamulValue.join(',');
});
},
),
const SizedBox(height: 16), // Add space between elements
buildFormField('namemmm'),
SizedBox(height: 16),
Text(selectedselectdyamulValue.join(',')),
],
);
} else {
return Center(child: CircularProgressIndicator());
}
},
),
FutureBuilder<List<Map<String, dynamic>>>(
future: _loadselectautoItems(),
builder: (context,
AsyncSnapshot<List<Map<String, dynamic>>> snapshot) {
if (snapshot.connectionState == ConnectionState.done) {
if (snapshot.hasError) {
return Text('Error: ${snapshot.error}');
}
final selectauto = snapshot.data ?? [];
final fieldNameItems = selectauto
.map((e) => e['name'])
.where((name) => name != null)
.cast<String>()
.toList();
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Autocomplete<String>(
optionsBuilder:
(TextEditingValue textEditingValue) {
if (textEditingValue.text.isEmpty) {
return const Iterable<String>.empty();
} else {
List<String> matches = <String>[];
matches.addAll(fieldNameItems);
matches.retainWhere((s) => s
.toLowerCase()
.contains(
textEditingValue.text.toLowerCase()));
return matches;
}
},
onSelected: (String selection) {
setState(() {
selectedselectautoValue = selection;
selectedselectautoId = selectauto.firstWhere(
(element) =>
element['namem'] == selection)['id'];
widget.entity['selectauto'] =
selectedselectautoId;
});
},
fieldViewBuilder: (BuildContext context,
TextEditingController textEditingController,
FocusNode focusNode,
VoidCallback onFieldSubmitted) {
return TextFormField(
controller: textEditingController,
focusNode: focusNode,
decoration: InputDecoration(
contentPadding: const EdgeInsets.symmetric(
horizontal: 16.0),
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(8.0),
borderSide: BorderSide(
color: Colors.deepPurple, width: 2),
),
enabledBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(8.0),
borderSide: BorderSide(
color: Colors.deepPurple, width: 2),
),
focusedBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(8.0),
borderSide: BorderSide(
color: Colors.deepPurpleAccent,
width: 2),
),
hintText: 'Select selectauto',
hintStyle: TextStyle(color: Colors.grey[600]),
),
);
},
),
SizedBox(height: 16),
Text(
'Selected Value: ${selectedselectautoValue.isNotEmpty ? selectedselectautoValue : "None"}'),
],
);
} else {
return Center(child: CircularProgressIndicator());
}
},
),
FutureBuilder<List<String>>(
future: _loadselectautomulItems(),
builder: (context, AsyncSnapshot<List<String>> snapshot) {
if (snapshot.connectionState == ConnectionState.done) {
final selectautomulItems = snapshot.data ?? [];
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Autocomplete<String>(
optionsBuilder: (TextEditingValue textEditingValue) {
if (textEditingValue.text.isEmpty) {
return const Iterable<String>.empty();
} else {
List<String> matches = <String>[];
matches.addAll(selectautomulItems);
matches.retainWhere((s) =>
s.toLowerCase().contains(textEditingValue.text.toLowerCase()));
return matches;
}
},
onSelected: (String selection) {
setState(() {
if (selectedselectautomulValue.contains(selection)) {
selectedselectautomulValue.remove(selection);
} else {
selectedselectautomulValue.add(selection);
}
widget.entity['selectautomul'] = selectedselectautomulValue.join(',');
});
},
),
SizedBox(height: 16),
Text(selectedselectautomulValue.join(',')),
],
);
} else {
return Center(child: CircularProgressIndicator());
}
},
),
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),
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'),
),
],
),
),
ReusableTextField(
initialValue: widget.entity['numbers'].toString(),
onSaved: (value) => widget.entity['numbers']= value,
label: "Enter Numbers",
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['numberk'].toString(),
onSaved: (value) => widget.entity['numberk']= value,
label: "Enter Numberk",
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(
@ -166,6 +747,28 @@ Padding(
try {
await provider.updateEntity(
@ -175,6 +778,28 @@ Padding(
Navigator.pop(context);

View File

@ -63,4 +63,66 @@ class TestmRepoScreen {
Future<dynamic> getselectdya() async {
try {
String apiUrl = "$baseUrl/Testm_ListFilter1/Testm_ListFilter1";
final response = await _helper.getGetApiResponse(apiUrl);
return response;
} catch (e) {
throw Exception('Failed to Get: $e');
}
}
Future<dynamic> getselectdyamul() async {
try {
String apiUrl = "$baseUrl/Testm_ListFilter1/Testm_ListFilter1";
final response = await _helper.getGetApiResponse(apiUrl);
return response;
} catch (e) {
throw Exception('Failed to Get: $e');
}
}
Future<dynamic> getselectauto() async {
try {
String apiUrl = "$baseUrl/Testm_ListFilter1/Testm_ListFilter1";
final response = await _helper.getGetApiResponse(apiUrl);
return response;
} catch (e) {
throw Exception('Failed to Get: $e');
}
}
Future<dynamic> getselectautomul() async {
try {
String apiUrl = "$baseUrl/Testm_ListFilter1/Testm_ListFilter1";
final response = await _helper.getGetApiResponse(apiUrl);
return response;
} catch (e) {
throw Exception('Failed to Get: $e');
}
}
Future<dynamic> getdataggGrid() async {
try {
String apiUrl = "$baseUrl/Testm_ListFilter1/Testm_ListFilter1";
final response = await _helper.getGetApiResponse(apiUrl);
return response;
} catch (e) {
throw Exception('Failed to Upload datagg: $e');
}
}
}

View File

@ -102,4 +102,97 @@ class TestmViewModelScreen extends ChangeNotifier{
List<Map<String, dynamic>> selectdyaItems = [];
Future<List<Map<String, dynamic>>> getselectdya() async {
try {
final value = await repo.getselectdya();
selectdyaItems = (value as List)
.map((item) => item as Map<String, dynamic>)
.toList();
return selectdyaItems;
} catch (e) {
throw Exception('Failed to get all: $e');
}
}
List<Map<String, dynamic>> selectdyamulItems = [];
Future<List<Map<String, dynamic>>> getselectdyamul() async {
try {
final value = await repo.getselectdyamul();
selectdyamulItems = (value as List)
.map((item) => item as Map<String, dynamic>)
.toList();
return selectdyamulItems;
} catch (e) {
throw Exception('Failed to get all: $e');
}
}
List<Map<String, dynamic>> selectautoItems = [];
Future<List<Map<String, dynamic>>> getselectauto() async {
try {
final value = await repo.getselectauto();
selectautoItems = (value as List)
.map((item) => item as Map<String, dynamic>)
.toList();
return selectautoItems;
} catch (e) {
throw Exception('Failed to get all: $e');
}
}
List<Map<String, dynamic>> selectautomulItems = [];
Future<List<Map<String, dynamic>>> getselectautomul() async {
try {
final value = await repo.getselectautomul();
selectautomulItems = (value as List)
.map((item) => item as Map<String, dynamic>)
.toList();
return selectautomulItems;
} catch (e) {
throw Exception('Failed to get all: $e');
}
}
late List<Map<String, dynamic>> dataggdataFuture =
[]; // Data from fetchData
Future<List<Map<String, dynamic>>> getdataggGrid() async {
try {
final value = await repo.getdataggGrid();
dataggdataFuture = (value as List)
.map((item) => item as Map<String, dynamic>)
.toList();
return dataggdataFuture;
} 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(