Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
medapp_eksad
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
qorri_di
medapp_eksad
Commits
611fe657
Commit
611fe657
authored
Sep 20, 2022
by
Tohap Maruli Pasaribu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
retrieve data on Action="View" in Data User
parent
a99c1728
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
554 additions
and
373 deletions
+554
-373
admin_userControl.dart
lib/dashboard/admin/admin_userControl.dart
+554
-373
No files found.
lib/dashboard/admin/admin_userControl.dart
View file @
611fe657
...
...
@@ -11,25 +11,135 @@ class UserControl extends StatefulWidget {
}
class
_UserControlState
extends
State
<
UserControl
>
{
void
apiService
(
BuildContext
context
)
{
FutureBuilder
<
List
<
dynamic
>>(
future:
getUserControl
(),
builder:
(
BuildContext
context
,
AsyncSnapshot
snapshot
)
{
if
(
snapshot
.
hasError
||
snapshot
.
data
==
null
||
snapshot
.
connectionState
==
ConnectionState
.
waiting
)
{
return
const
CircularProgressIndicator
();
}
return
snapshot
.
data
;
});
}
final
formKey
=
GlobalKey
<
FormState
>();
final
nameRSController
=
TextEditingController
();
@override
Widget
build
(
BuildContext
context
)
{
var
screenSize
=
MediaQuery
.
of
(
context
).
size
;
return
Padding
(
padding:
const
EdgeInsets
.
all
(
30.0
),
child:
Container
(
padding:
const
EdgeInsets
.
symmetric
(
horizontal:
10
),
decoration:
BoxDecoration
(
color:
Colors
.
white60
,
borderRadius:
BorderRadius
.
circular
(
20
),
boxShadow:
[
BoxShadow
(
color:
const
Color
.
fromARGB
(
255
,
10
,
116
,
255
).
withAlpha
(
60
),
blurRadius:
5.0
,
spreadRadius:
5.0
,
offset:
const
Offset
(
0.0
,
3.0
))
]),
child:
Column
(
children:
[
Container
(
height:
screenSize
.
height
*
0.15
,
child:
Center
(
child:
Text
(
'Data User'
,
style:
GoogleFonts
.
poppins
(
height:
1.5
,
fontSize:
31
,
fontWeight:
FontWeight
.
bold
,
color:
Colors
.
blueAccent
[
200
]),
),
),
),
Container
(
height:
screenSize
.
height
*
0.65
,
child:
ListView
(
controller:
ScrollController
(),
children:
[
FutureBuilder
<
List
<
dynamic
>>(
future:
getUserControl
(),
builder:
(
BuildContext
context
,
AsyncSnapshot
snapshot
)
{
if
(
snapshot
.
hasError
||
snapshot
.
data
==
null
||
snapshot
.
connectionState
==
ConnectionState
.
waiting
)
{
return
const
CircularProgressIndicator
();
}
return
DataTable
(
decoration:
const
BoxDecoration
(
color:
Colors
.
white
),
columnSpacing:
55
,
columns:
const
[
DataColumn
(
label:
Text
(
"ID"
,
style:
TextStyle
(
fontWeight:
FontWeight
.
bold
),
)),
DataColumn
(
label:
Text
(
"Nama Rumah Sakit"
,
style:
TextStyle
(
fontWeight:
FontWeight
.
bold
),
)),
// DataColumn(label: Text("Telp Rumah Sakit")),
DataColumn
(
label:
Text
(
"Alamat Rumah Sakit"
,
style:
TextStyle
(
fontWeight:
FontWeight
.
bold
),
)),
// DataColumn(label: Text("Nama PIC")),
// DataColumn(label: Text("Telp PIC")),
// DataColumn(label: Text("Email PIC")),
DataColumn
(
label:
Text
(
"STATUS"
,
style:
TextStyle
(
fontWeight:
FontWeight
.
bold
),
)),
DataColumn
(
label:
Text
(
"ACTION"
,
style:
TextStyle
(
fontWeight:
FontWeight
.
bold
),
))
],
rows:
List
.
generate
(
snapshot
.
data
.
length
,
(
index
)
{
var
pgm
=
snapshot
.
data
[
index
];
final
nameRSController
=
TextEditingController
()
..
text
=
pgm
[
'namaRs'
].
toString
();
final
phoneRSController
=
TextEditingController
();
final
addressRSController
=
TextEditingController
();
final
addressRSController
=
TextEditingController
();
final
namePICController
=
TextEditingController
();
final
phonePICController
=
TextEditingController
();
final
addressPICController
=
TextEditingController
();
final
emailPICController
=
TextEditingController
();
final
passwordController
=
TextEditingController
();
final
phonePICController
=
TextEditingController
();
final
addressPICController
=
TextEditingController
();
final
emailPICController
=
TextEditingController
();
final
passwordController
=
TextEditingController
();
void
viewUser
(
BuildContext
context
)
{
var
screenSize
=
MediaQuery
.
of
(
context
).
size
;
showDialog
(
context:
context
,
builder:
(
BuildContext
context
)
{
// var pgm = snapshot.data;
// print(pgm);
// if (snapshot.hasError ||
// snapshot.data == null ||
// snapshot.connectionState == ConnectionState.waiting) {
// return const CircularProgressIndicator();
// }
return
AlertDialog
(
// title: Text("Alert!!!"),
// content: Text("Your are awesome!"),
content:
Form
(
child:
Container
(
padding:
EdgeInsets
.
only
(
...
...
@@ -38,30 +148,47 @@ class _UserControlState extends State<UserControl> {
width:
screenSize
.
width
*
0.50
,
height:
screenSize
.
height
*
0.55
,
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
mainAxisAlignment:
MainAxisAlignment
.
spaceEvenly
,
crossAxisAlignment:
CrossAxisAlignment
.
start
,
mainAxisAlignment:
MainAxisAlignment
.
spaceEvenly
,
children:
[
const
Spacer
(),
Container
(
padding:
EdgeInsets
.
only
(
left:
screenSize
.
width
*
0.15
),
padding:
EdgeInsets
.
only
(
left:
screenSize
.
width
*
0.15
),
height:
screenSize
.
width
*
0.03
,
child:
Image
.
asset
(
"assets/logo/medapp-logo.png"
),
child:
Image
.
asset
(
"assets/logo/medapp-logo.png"
),
),
const
SizedBox
(
height:
20
),
Row
(
children:
[
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
mainAxisAlignment:
MainAxisAlignment
.
spaceEvenly
,
crossAxisAlignment:
CrossAxisAlignment
.
start
,
mainAxisAlignment:
MainAxisAlignment
.
spaceEvenly
,
children:
[
Row
(
children:
[
Icon
(
Icons
.
drive_file_rename_outline
,
color:
Colors
.
grey
[
500
],
size:
screenSize
.
width
*
0.01
),
const
SizedBox
(
width:
10
),
const
Text
(
"Nama Rumah Sakit"
,
style:
TextStyle
(
fontSize:
13
))
Icon
(
Icons
.
drive_file_rename_outline
,
color:
Colors
.
grey
[
500
],
size:
screenSize
.
width
*
0.01
),
const
SizedBox
(
width:
10
),
const
Text
(
"Nama Rumah Sakit"
,
style:
TextStyle
(
fontSize:
13
))
],
),
const
SizedBox
(
height:
5
),
...
...
@@ -69,18 +196,34 @@ class _UserControlState extends State<UserControl> {
children:
[
SizedBox
(
height:
60
,
width:
screenSize
.
width
*
0.2
,
child:
TextFormField
(
controller:
nameRSController
,
textAlign:
TextAlign
.
start
,
width:
screenSize
.
width
*
0.2
,
child:
TextFormField
(
controller:
nameRSController
,
textAlign:
TextAlign
.
start
,
decoration:
InputDecoration
(
labelText:
"Nama Rumah Sakit"
,
labelStyle:
TextStyle
(
fontSize:
13
),
labelText:
"Nama Rumah Sakit"
,
labelStyle:
TextStyle
(
fontSize:
13
),
border:
OutlineInputBorder
(
borderRadius:
BorderRadius
.
circular
(
5.0
))),
validator:
(
value
)
{
if
(
value
==
null
||
value
.
isEmpty
)
{
BorderRadius
.
circular
(
5.0
))),
readOnly:
true
,
validator:
(
value
)
{
if
(
value
==
null
||
value
.
isEmpty
)
{
return
"Nama Rumah Sakit tidak boleh kosong"
;
}
else
{
return
null
;
...
...
@@ -94,23 +237,32 @@ class _UserControlState extends State<UserControl> {
),
const
SizedBox
(
width:
30
),
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
mainAxisAlignment:
MainAxisAlignment
.
spaceEvenly
,
crossAxisAlignment:
CrossAxisAlignment
.
start
,
mainAxisAlignment:
MainAxisAlignment
.
spaceEvenly
,
children:
[
// ===============nama pic=============
Row
(
children:
[
Icon
(
Icons
.
drive_file_rename_outline
,
color:
Colors
.
grey
[
500
],
size:
screenSize
.
width
*
0.01
,
Icons
.
drive_file_rename_outline
,
color:
Colors
.
grey
[
500
],
size:
screenSize
.
width
*
0.01
,
),
const
SizedBox
(
width:
10
,
),
const
Text
(
"Nama PIC"
,
style:
TextStyle
(
fontSize:
13
),
style:
TextStyle
(
fontSize:
13
),
),
],
),
...
...
@@ -121,19 +273,34 @@ class _UserControlState extends State<UserControl> {
children:
[
SizedBox
(
height:
60
,
width:
screenSize
.
width
*
0.2
,
child:
TextFormField
(
controller:
namePICController
,
textAlign:
TextAlign
.
start
,
decoration:
InputDecoration
(
labelText:
"Nama PIC"
,
labelStyle:
TextStyle
(
fontSize:
13
),
border:
OutlineInputBorder
(
width:
screenSize
.
width
*
0.2
,
child:
TextFormField
(
controller:
namePICController
,
textAlign:
TextAlign
.
start
,
decoration:
InputDecoration
(
labelText:
"Nama PIC"
,
labelStyle:
TextStyle
(
fontSize:
13
),
border:
OutlineInputBorder
(
borderRadius:
BorderRadius
.
circular
(
5.0
),
)),
validator:
(
value
)
{
if
(
value
==
null
||
value
.
isEmpty
)
{
validator:
(
value
)
{
if
(
value
==
null
||
value
.
isEmpty
)
{
return
"Nama PIC tidak boleh kosong"
;
}
return
null
;
...
...
@@ -150,23 +317,32 @@ class _UserControlState extends State<UserControl> {
Row
(
children:
[
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
mainAxisAlignment:
MainAxisAlignment
.
spaceEvenly
,
crossAxisAlignment:
CrossAxisAlignment
.
start
,
mainAxisAlignment:
MainAxisAlignment
.
spaceEvenly
,
children:
[
// ===============alamat rs==========
Row
(
children:
[
Icon
(
Icons
.
add_home_work_sharp
,
color:
Colors
.
grey
[
500
],
size:
screenSize
.
width
*
0.01
,
Icons
.
add_home_work_sharp
,
color:
Colors
.
grey
[
500
],
size:
screenSize
.
width
*
0.01
,
),
const
SizedBox
(
width:
10
,
),
const
Text
(
"Alamat Rumah Sakit"
,
style:
TextStyle
(
fontSize:
13
),
style:
TextStyle
(
fontSize:
13
),
),
],
),
...
...
@@ -177,21 +353,37 @@ class _UserControlState extends State<UserControl> {
children:
[
SizedBox
(
height:
60
,
width:
screenSize
.
width
*
0.2
,
child:
TextFormField
(
controller:
addressRSController
,
textAlign:
TextAlign
.
start
,
validator:
(
value
)
{
if
(
value
==
null
||
value
.
isEmpty
)
{
width:
screenSize
.
width
*
0.2
,
child:
TextFormField
(
controller:
addressRSController
,
textAlign:
TextAlign
.
start
,
validator:
(
value
)
{
if
(
value
==
null
||
value
.
isEmpty
)
{
return
"Nomor Alamat Rumah Sakit tidak boleh kosong"
;
}
return
null
;
},
decoration:
InputDecoration
(
labelText:
"Nomor Alamat Rumah Sakit"
,
labelStyle:
TextStyle
(
fontSize:
13
),
hintStyle:
const
TextStyle
(),
border:
OutlineInputBorder
(
decoration:
InputDecoration
(
labelText:
"Nomor Alamat Rumah Sakit"
,
labelStyle:
TextStyle
(
fontSize:
13
),
hintStyle:
const
TextStyle
(),
border:
OutlineInputBorder
(
borderRadius:
BorderRadius
.
circular
(
5.0
),
)),
...
...
@@ -206,23 +398,32 @@ class _UserControlState extends State<UserControl> {
width:
30
,
),
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
mainAxisAlignment:
MainAxisAlignment
.
spaceEvenly
,
crossAxisAlignment:
CrossAxisAlignment
.
start
,
mainAxisAlignment:
MainAxisAlignment
.
spaceEvenly
,
children:
[
// ===============email pic==========
Row
(
children:
[
Icon
(
Icons
.
email_outlined
,
color:
Colors
.
grey
[
500
],
size:
screenSize
.
width
*
0.01
,
Icons
.
email_outlined
,
color:
Colors
.
grey
[
500
],
size:
screenSize
.
width
*
0.01
,
),
const
SizedBox
(
width:
10
,
),
const
Text
(
"Email PIC"
,
style:
TextStyle
(
fontSize:
13
),
style:
TextStyle
(
fontSize:
13
),
),
],
),
...
...
@@ -233,21 +434,37 @@ class _UserControlState extends State<UserControl> {
children:
[
SizedBox
(
height:
60
,
width:
screenSize
.
width
*
0.2
,
child:
TextFormField
(
controller:
emailPICController
,
textAlign:
TextAlign
.
start
,
validator:
(
value
)
{
if
(
value
==
null
||
value
.
isEmpty
)
{
width:
screenSize
.
width
*
0.2
,
child:
TextFormField
(
controller:
emailPICController
,
textAlign:
TextAlign
.
start
,
validator:
(
value
)
{
if
(
value
==
null
||
value
.
isEmpty
)
{
return
"Email PIC tidak boleh kosong"
;
}
return
null
;
},
decoration:
InputDecoration
(
labelText:
"Email PIC"
,
labelStyle:
TextStyle
(
fontSize:
13
),
hintStyle:
const
TextStyle
(),
border:
OutlineInputBorder
(
decoration:
InputDecoration
(
labelText:
"Email PIC"
,
labelStyle:
TextStyle
(
fontSize:
13
),
hintStyle:
const
TextStyle
(),
border:
OutlineInputBorder
(
borderRadius:
BorderRadius
.
circular
(
5.0
),
)),
...
...
@@ -263,23 +480,31 @@ class _UserControlState extends State<UserControl> {
Row
(
children:
[
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
mainAxisAlignment:
MainAxisAlignment
.
spaceEvenly
,
crossAxisAlignment:
CrossAxisAlignment
.
start
,
mainAxisAlignment:
MainAxisAlignment
.
spaceEvenly
,
children:
[
// ===============telepon rs==========
Row
(
children:
[
Icon
(
Icons
.
phone_android
,
color:
Colors
.
grey
[
500
],
size:
screenSize
.
width
*
0.01
,
color:
Colors
.
grey
[
500
],
size:
screenSize
.
width
*
0.01
,
),
const
SizedBox
(
width:
10
,
),
const
Text
(
"No Telepon Rumah Sakit"
,
style:
TextStyle
(
fontSize:
13
),
style:
TextStyle
(
fontSize:
13
),
),
],
),
...
...
@@ -290,21 +515,37 @@ class _UserControlState extends State<UserControl> {
children:
[
SizedBox
(
height:
60
,
width:
screenSize
.
width
*
0.2
,
child:
TextFormField
(
controller:
phoneRSController
,
textAlign:
TextAlign
.
start
,
validator:
(
value
)
{
if
(
value
==
null
||
value
.
isEmpty
)
{
width:
screenSize
.
width
*
0.2
,
child:
TextFormField
(
controller:
phoneRSController
,
textAlign:
TextAlign
.
start
,
validator:
(
value
)
{
if
(
value
==
null
||
value
.
isEmpty
)
{
return
"Nomor Telepon Rumah Sakit tidak boleh kosong"
;
}
return
null
;
},
decoration:
InputDecoration
(
labelText:
"Nomor Telepon Rumah Sakit"
,
labelStyle:
TextStyle
(
fontSize:
13
),
hintStyle:
const
TextStyle
(),
border:
OutlineInputBorder
(
decoration:
InputDecoration
(
labelText:
"Nomor Telepon Rumah Sakit"
,
labelStyle:
TextStyle
(
fontSize:
13
),
hintStyle:
const
TextStyle
(),
border:
OutlineInputBorder
(
borderRadius:
BorderRadius
.
circular
(
5.0
),
)),
...
...
@@ -319,23 +560,31 @@ class _UserControlState extends State<UserControl> {
width:
30
,
),
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
mainAxisAlignment:
MainAxisAlignment
.
spaceEvenly
,
crossAxisAlignment:
CrossAxisAlignment
.
start
,
mainAxisAlignment:
MainAxisAlignment
.
spaceEvenly
,
children:
[
// ===============telepon pic==========
Row
(
children:
[
Icon
(
Icons
.
phone_android
,
color:
Colors
.
grey
[
500
],
size:
screenSize
.
width
*
0.01
,
color:
Colors
.
grey
[
500
],
size:
screenSize
.
width
*
0.01
,
),
const
SizedBox
(
width:
10
,
),
const
Text
(
"No Telepon PIC"
,
style:
TextStyle
(
fontSize:
13
),
style:
TextStyle
(
fontSize:
13
),
),
],
),
...
...
@@ -346,21 +595,37 @@ class _UserControlState extends State<UserControl> {
children:
[
SizedBox
(
height:
60
,
width:
screenSize
.
width
*
0.2
,
child:
TextFormField
(
controller:
phonePICController
,
textAlign:
TextAlign
.
start
,
validator:
(
value
)
{
if
(
value
==
null
||
value
.
isEmpty
)
{
width:
screenSize
.
width
*
0.2
,
child:
TextFormField
(
controller:
phonePICController
,
textAlign:
TextAlign
.
start
,
validator:
(
value
)
{
if
(
value
==
null
||
value
.
isEmpty
)
{
return
"Nomor Telepon PIC tidak boleh kosong"
;
}
return
null
;
},
decoration:
InputDecoration
(
labelText:
"Nomor Telepon PIC"
,
labelStyle:
TextStyle
(
fontSize:
13
),
hintStyle:
const
TextStyle
(),
border:
OutlineInputBorder
(
decoration:
InputDecoration
(
labelText:
"Nomor Telepon PIC"
,
labelStyle:
TextStyle
(
fontSize:
13
),
hintStyle:
const
TextStyle
(),
border:
OutlineInputBorder
(
borderRadius:
BorderRadius
.
circular
(
5.0
),
)),
...
...
@@ -387,90 +652,6 @@ class _UserControlState extends State<UserControl> {
});
}
@override
Widget
build
(
BuildContext
context
)
{
var
screenSize
=
MediaQuery
.
of
(
context
).
size
;
return
Padding
(
padding:
const
EdgeInsets
.
all
(
30.0
),
child:
Container
(
padding:
const
EdgeInsets
.
symmetric
(
horizontal:
10
),
decoration:
BoxDecoration
(
color:
Colors
.
white60
,
borderRadius:
BorderRadius
.
circular
(
20
),
boxShadow:
[
BoxShadow
(
color:
const
Color
.
fromARGB
(
255
,
10
,
116
,
255
).
withAlpha
(
60
),
blurRadius:
5.0
,
spreadRadius:
5.0
,
offset:
const
Offset
(
0.0
,
3.0
))
]),
child:
Column
(
children:
[
Container
(
height:
screenSize
.
height
*
0.15
,
child:
Center
(
child:
Text
(
'Data User'
,
style:
GoogleFonts
.
poppins
(
height:
1.5
,
fontSize:
31
,
fontWeight:
FontWeight
.
bold
,
color:
Colors
.
blueAccent
[
200
]),
),
),
),
Container
(
height:
screenSize
.
height
*
0.65
,
child:
ListView
(
controller:
ScrollController
(),
children:
[
FutureBuilder
<
List
<
dynamic
>>(
future:
getUserControl
(),
builder:
(
BuildContext
context
,
AsyncSnapshot
snapshot
)
{
if
(
snapshot
.
hasError
||
snapshot
.
data
==
null
||
snapshot
.
connectionState
==
ConnectionState
.
waiting
)
{
return
const
CircularProgressIndicator
();
}
return
DataTable
(
decoration:
const
BoxDecoration
(
color:
Colors
.
white
),
columnSpacing:
55
,
columns:
const
[
DataColumn
(
label:
Text
(
"ID"
,
style:
TextStyle
(
fontWeight:
FontWeight
.
bold
),
)),
DataColumn
(
label:
Text
(
"Nama Rumah Sakit"
,
style:
TextStyle
(
fontWeight:
FontWeight
.
bold
),
)),
// DataColumn(label: Text("Telp Rumah Sakit")),
DataColumn
(
label:
Text
(
"Alamat Rumah Sakit"
,
style:
TextStyle
(
fontWeight:
FontWeight
.
bold
),
)),
// DataColumn(label: Text("Nama PIC")),
// DataColumn(label: Text("Telp PIC")),
// DataColumn(label: Text("Email PIC")),
DataColumn
(
label:
Text
(
"STATUS"
,
style:
TextStyle
(
fontWeight:
FontWeight
.
bold
),
)),
DataColumn
(
label:
Text
(
"ACTION"
,
style:
TextStyle
(
fontWeight:
FontWeight
.
bold
),
))
],
rows:
List
.
generate
(
snapshot
.
data
.
length
,
(
index
)
{
var
pgm
=
snapshot
.
data
[
index
];
return
DataRow
(
cells:
[
DataCell
(
Text
(
pgm
[
'idUser'
].
toString
())),
DataCell
(
Text
(
pgm
[
'namaRs'
].
toString
())),
...
...
@@ -492,7 +673,7 @@ class _UserControlState extends State<UserControl> {
onSelected:
(
value
)
{
if
(
value
==
1
)
{
print
(
"you choose Edit..."
);
//
viewUser(context);
viewUser
(
context
);
}
else
if
(
value
==
2
)
{
print
(
"you choose Delete..."
);
}
else
if
(
value
==
3
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment