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
752af512
Commit
752af512
authored
Sep 26, 2022
by
Tohap Maruli Pasaribu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
delete data on Action="Delete" in Data User
parent
52700c50
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
55 additions
and
2 deletions
+55
-2
userControl_api.dart
lib/api/userControl_api.dart
+12
-0
admin_userControl.dart
lib/dashboard/admin/admin_userControl.dart
+43
-2
No files found.
lib/api/userControl_api.dart
View file @
752af512
...
...
@@ -3,9 +3,21 @@ import 'dart:convert';
import
'package:http/http.dart'
as
http
;
var
qry
=
'https://dmsdev-api.eksad.com/gateway/medapp/v1/qry'
;
var
cmd
=
'https://dmsdev-api.eksad.com/gateway/medapp/v1/cmd'
;
Future
<
List
<
dynamic
>>
getUserControl
()
async
{
var
response
=
await
http
.
get
(
Uri
.
parse
(
'
$qry
/user/get'
));
return
jsonDecode
(
response
.
body
)[
'data'
];
}
Future
<
bool
>
deleteUserControl
(
idUser
)
async
{
final
response
=
await
http
.
post
(
Uri
.
parse
(
'
$cmd
/user/updateUser'
),
body:
jsonEncode
({
"idUser"
:
idUser
}),
headers:
{
'Content-type'
:
'application/json; charset=UTF-8'
});
if
(
response
.
statusCode
==
200
)
{
return
true
;
}
else
{
return
false
;
}
}
lib/dashboard/admin/admin_userControl.dart
View file @
752af512
...
...
@@ -657,6 +657,48 @@ class _UserControlState extends State<UserControl> {
});
}
void
deleteUser
(
BuildContext
context
)
{
showDialog
(
context:
context
,
builder:
(
BuildContext
context
)
{
return
AlertDialog
(
title:
const
Text
(
"Warning"
),
content:
Text
(
"Are you sure want to delete data
${pgm['idUser']}
?"
),
actions:
<
Widget
>[
TextButton
(
child:
const
Text
(
"Yes"
),
onPressed:
()
{
Navigator
.
pop
(
context
);
deleteUserControl
(
pgm
[
'idUser'
])
.
then
((
isSuccess
)
{
if
(
isSuccess
)
{
setState
(()
{});
ScaffoldMessenger
.
of
(
this
.
context
)
.
showSnackBar
(
const
SnackBar
(
content:
Text
(
"Delete data success"
)));
}
else
{
ScaffoldMessenger
.
of
(
this
.
context
)
.
showSnackBar
(
const
SnackBar
(
content:
Text
(
"Delete data failed"
)));
}
});
},
),
TextButton
(
onPressed:
()
{
Navigator
.
pop
(
context
);
},
child:
const
Text
(
"No"
))
],
);
});
}
return
DataRow
(
cells:
[
DataCell
(
Text
(
pgm
[
'idUser'
].
toString
())),
DataCell
(
Text
(
pgm
[
'namaRs'
].
toString
())),
...
...
@@ -681,20 +723,19 @@ class _UserControlState extends State<UserControl> {
viewUser
(
context
);
}
else
if
(
value
==
2
)
{
print
(
"you choose Delete..."
);
deleteUser
(
context
);
}
else
if
(
value
==
3
)
{
print
(
"you choose View..."
);
viewUser
(
context
);
}
},
))
]);
}).
toList
());
})
],
),
)
],
),
),
...
...
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