Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OKU-GIS
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
Muhamad
OKU-GIS
Commits
2f08a104
Commit
2f08a104
authored
Jul 11, 2021
by
reynaldi adriantama
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
user management
parent
3bf8fe59
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
846 additions
and
238 deletions
+846
-238
API/__pycache__/urls.cpython-39.pyc
API/__pycache__/urls.cpython-39.pyc
+0
-0
Application/urls.py
Application/urls.py
+0
-6
OKU/urls.py
OKU/urls.py
+5
-1
myauth/views.py
myauth/views.py
+201
-3
templates/includes/navbar.html
templates/includes/navbar.html
+1
-1
templates/layout/base.html
templates/layout/base.html
+1
-1
templates/layout/user_layout.html
templates/layout/user_layout.html
+637
-225
templates/maps/e.html
templates/maps/e.html
+1
-1
No files found.
API/__pycache__/urls.cpython-39.pyc
View file @
2f08a104
No preview for this file type
Application/urls.py
View file @
2f08a104
...
@@ -12,11 +12,5 @@ urlpatterns = [
...
@@ -12,11 +12,5 @@ urlpatterns = [
path
(
'CheckByAddress'
,
views
.
SearchLocation
.
as_view
(),
name
=
'CheckByAddress'
),
path
(
'CheckByAddress'
,
views
.
SearchLocation
.
as_view
(),
name
=
'CheckByAddress'
),
path
(
'CheckByRadius'
,
views
.
SearchRadius
.
as_view
(),
name
=
'CheckByRadius'
),
path
(
'CheckByRadius'
,
views
.
SearchRadius
.
as_view
(),
name
=
'CheckByRadius'
),
path
(
'CheckByPolygon'
,
views
.
SearchPolygon
.
as_view
(),
name
=
'CheckByPolygon'
),
path
(
'CheckByPolygon'
,
views
.
SearchPolygon
.
as_view
(),
name
=
'CheckByPolygon'
),
<<<<<<<
HEAD
# path('usermanagement', views.User.as_view(), name='User'),
=======
path
(
'editkelurahan'
,
edit
.
editkelurahan
,
name
=
'edit_kel'
),
path
(
'editkelurahan'
,
edit
.
editkelurahan
,
name
=
'edit_kel'
),
>>>>>>>
b0c9d3a5aeeba4afcaecade4a93365407e62fc2b
]
]
\ No newline at end of file
OKU/urls.py
View file @
2f08a104
...
@@ -28,5 +28,9 @@ urlpatterns = [
...
@@ -28,5 +28,9 @@ urlpatterns = [
# path('myauth/', include('myauth.urls')),
# path('myauth/', include('myauth.urls')),
path
(
'login/'
,
views
.
CustomLoginView
.
as_view
(),
name
=
'login'
),
path
(
'login/'
,
views
.
CustomLoginView
.
as_view
(),
name
=
'login'
),
path
(
'logout/'
,
views
.
CustomLogoutView
.
as_view
(),
name
=
'logout'
),
path
(
'logout/'
,
views
.
CustomLogoutView
.
as_view
(),
name
=
'logout'
),
path
(
'usermanagement/'
,
views
.
Usermanagement
.
as_view
(),
name
=
'usermanagement'
)
path
(
'usermanagement/'
,
views
.
Usermanagement
.
as_view
(),
name
=
'usermanagement'
),
path
(
'adduser/'
,
views
.
addUser
,
name
=
"adduser"
),
path
(
'getallGroups/'
,
views
.
listGroup
,
name
=
"getallGroups"
),
path
(
'switchStatus/'
,
views
.
deactivateUser
,
name
=
"switchStatus"
),
path
(
'loadUserbyId/'
,
views
.
loadUserbyId
,
name
=
"loadUserbyId"
)
]
]
myauth/views.py
View file @
2f08a104
from
decimal
import
Context
from
decimal
import
Context
from
typing
import
get_origin
from
django.db.models.expressions
import
F
from
django.http
import
response
from
django.views
import
View
,
generic
from
django.views
import
View
,
generic
from
django.shortcuts
import
render
from
django.shortcuts
import
render
from
django.contrib
import
messages
from
django.contrib.auth.views
import
LoginView
,
LogoutView
from
django.contrib.auth.views
import
LoginView
,
LogoutView
from
django.db
import
connection
as
conn
from
django.db
import
connection
as
conn
,
models
from
django.core
import
serializers
from
django.core
import
serializers
from
django.contrib.auth.models
import
User
,
Group
from
django.contrib.auth.hashers
import
make_password
from
rest_framework
import
status
from
rest_framework.decorators
import
api_view
,
renderer_classes
from
rest_framework.response
import
Response
# Create your views here.
# Create your views here.
...
@@ -26,7 +36,7 @@ class Usermanagement(generic.TemplateView):
...
@@ -26,7 +36,7 @@ class Usermanagement(generic.TemplateView):
def
get
(
self
,
request
):
def
get
(
self
,
request
):
with
conn
.
cursor
()
as
userlist_
:
with
conn
.
cursor
()
as
userlist_
:
userlist_
.
execute
(
"SELECT * from auth_user"
)
userlist_
.
execute
(
"SELECT * from auth_user
ORDER BY username ASC
"
)
allUser
=
userlist_
.
fetchall
()
allUser
=
userlist_
.
fetchall
()
...
@@ -38,7 +48,7 @@ class Usermanagement(generic.TemplateView):
...
@@ -38,7 +48,7 @@ class Usermanagement(generic.TemplateView):
"name"
:
rows
[
5
]
+
" "
+
rows
[
6
],
"name"
:
rows
[
5
]
+
" "
+
rows
[
6
],
"email"
:
rows
[
7
],
"email"
:
rows
[
7
],
"isactive"
:
rows
[
9
],
"isactive"
:
rows
[
9
],
"last
login
"
:
rows
[
2
]
"last"
:
rows
[
2
]
}
}
user_res
.
append
(
datas
)
user_res
.
append
(
datas
)
...
@@ -47,5 +57,193 @@ class Usermanagement(generic.TemplateView):
...
@@ -47,5 +57,193 @@ class Usermanagement(generic.TemplateView):
'title'
:
'user management'
,
'title'
:
'user management'
,
'data'
:
user_res
'data'
:
user_res
}
}
print
(
context
)
return
render
(
request
,
self
.
template_name
,
context
)
return
render
(
request
,
self
.
template_name
,
context
)
@
api_view
((
'POST'
,))
def
addUser
(
request
):
if
request
.
method
==
'POST'
:
usernames
=
request
.
POST
.
get
(
'username'
)
first_name
=
request
.
POST
.
get
(
'first_name'
)
last_name
=
request
.
POST
.
get
(
'last_name'
)
group
=
request
.
POST
.
get
(
'group'
)
email
=
request
.
POST
.
get
(
'email'
)
password
=
request
.
POST
.
get
(
'username'
)
iduser
=
request
.
POST
.
get
(
'id'
)
arrGroup
=
group
.
split
(
"~"
)
user
=
User
()
# user.save()
try
:
if
iduser
:
with
conn
.
cursor
()
as
cursor
:
cursor
.
execute
(
"UPDATE auth_user SET first_name = '"
+
first_name
+
"', last_name = '"
+
last_name
+
"', email = '"
+
email
+
"' WHERE id="
+
iduser
)
with
conn
.
cursor
()
as
curGroup
:
curGroup
.
execute
(
"DELETE FROM auth_user_groups WHERE user_id="
+
iduser
)
users
=
User
.
objects
.
get
(
username
=
usernames
)
for
i
in
arrGroup
:
insertgroups
=
Group
.
objects
.
get
(
name
=
i
)
insertgroups
.
user_set
.
add
(
users
)
data
=
{
"code"
:
0
,
"data"
:
"User telah diperbaharui."
,
"info"
:
"success"
}
else
:
user
=
User
.
objects
.
get
(
username
=
usernames
)
data
=
{
"code"
:
4
,
"data"
:
"username telah tersedia, silahkan coba lagi."
,
"info"
:
"failed"
}
except
User
.
DoesNotExist
:
user
.
username
=
usernames
user
.
first_name
=
first_name
user
.
last_name
=
last_name
user
.
email
=
email
user
.
password
=
make_password
(
password
)
user
.
save
()
# add user to group
userinsert
=
User
.
objects
.
get
(
username
=
usernames
)
for
i
in
arrGroup
:
insertgroups
=
Group
.
objects
.
get
(
name
=
i
)
insertgroups
.
user_set
.
add
(
userinsert
)
data
=
{
"code"
:
0
,
"info"
:
"success"
,
"data"
:
"user "
+
usernames
+
" berhasil ditambahkan"
}
# data = {'sukses':'sukses'}
return
Response
(
data
)
@
api_view
((
'POST'
,))
def
listGroup
(
request
):
if
request
.
method
==
"POST"
:
groupList
=
Group
.
objects
.
all
()
group
=
[]
for
g
in
groupList
:
group
.
append
(
g
.
name
)
if
len
(
group
)
>
0
:
data
=
{
"info"
:
"success"
,
"code"
:
0
,
"data"
:
group
}
else
:
data
=
{
"info"
:
"group tidak tersedia"
,
"code"
:
4
,
"data"
:
group
}
return
Response
(
data
)
@
api_view
((
'POST'
,))
def
deactivateUser
(
request
):
user
=
User
()
if
request
.
method
==
"POST"
:
ids
=
request
.
POST
.
get
(
'id'
)
status
=
request
.
POST
.
get
(
'stat'
)
isActive
=
loadUserStatus
(
ids
)
# print(type(status)+status)
# print(type(True))
print
(
status
==
'True'
)
if
status
==
'True'
:
sql
=
"f"
else
:
sql
=
"t"
with
conn
.
cursor
()
as
cursor
:
affected_row
=
cursor
.
execute
(
"UPDATE auth_user SET is_active = '"
+
sql
+
"' WHERE id = "
+
ids
)
print
(
"UPDATE auth_user SET is_active = '"
+
sql
+
"' WHERE id = "
+
ids
)
print
(
affected_row
)
if
affected_row
:
data
=
{
"info"
:
"success"
,
"code"
:
0
,
"data"
:
"User berhasil dinonaktifkan"
}
else
:
data
=
{
"info"
:
"success"
,
"code"
:
0
,
"data"
:
"User berhasil dinonaktifkan"
}
return
Response
(
data
)
def
loadUserStatus
(
id
):
with
conn
.
cursor
()
as
cursor
:
cursor
.
execute
(
"SELECT is_active from auth_user WHERE id="
+
id
+
""
)
resData
=
cursor
.
fetchall
()
for
i
in
resData
:
isActive
=
i
[
0
]
return
isActive
@
api_view
((
'POST'
,))
def
loadUserbyId
(
request
):
if
request
.
method
==
"POST"
:
id
=
request
.
POST
.
get
(
'id'
)
print
(
id
)
with
conn
.
cursor
()
as
cursor
:
cursor
.
execute
(
"SELECT * FROM auth_user WHERE id ="
+
id
)
result
=
cursor
.
fetchall
()
group_res
=
loadGroupById
(
id
)
user_res
=
[]
for
rows
in
result
:
datas
=
{
"id"
:
rows
[
0
],
"username"
:
rows
[
4
],
"firstname"
:
rows
[
5
],
"lastname"
:
rows
[
6
],
"email"
:
rows
[
7
],
"isactive"
:
rows
[
9
],
"last"
:
rows
[
2
],
"group"
:
group_res
}
user_res
.
append
(
datas
)
data
=
{
"info"
:
"success"
,
"code"
:
0
,
"data"
:
datas
,
}
return
Response
(
data
)
def
loadGroupById
(
iduser
):
with
conn
.
cursor
()
as
cursor
:
cursor
.
execute
(
"select ag.name from auth_group ag, auth_user_groups aug WHERE aug.user_id = "
+
iduser
+
" AND ag.id = aug.group_id"
)
result
=
cursor
.
fetchall
()
print
(
result
)
resGroup
=
[]
for
i
in
result
:
resGroup
.
append
(
i
[
0
])
print
(
resGroup
)
return
resGroup
\ No newline at end of file
templates/includes/navbar.html
View file @
2f08a104
...
@@ -28,7 +28,7 @@
...
@@ -28,7 +28,7 @@
<li><a
href=
"#"
><i
class=
"icon-user-plus"
></i>
My profile
</a></li>
<li><a
href=
"#"
><i
class=
"icon-user-plus"
></i>
My profile
</a></li>
<li><a
href=
"#"
><i
class=
"icon-cog5"
></i>
Account settings
</a></li>
<li><a
href=
"#"
><i
class=
"icon-cog5"
></i>
Account settings
</a></li>
<li
class=
"divider"
></li>
<li
class=
"divider"
></li>
<li><a
href=
"{% url 'logout' %}"
><i
class=
"icon-cog5"
></i>
Logout
</a></li>
</ul>
</ul>
</li>
</li>
</ul>
</ul>
...
...
templates/layout/base.html
View file @
2f08a104
...
@@ -240,7 +240,7 @@
...
@@ -240,7 +240,7 @@
{% include 'includes/navbar.html' %}
{% include 'includes/navbar.html' %}
<div
style=
"height:
605px
;"
>
<div
style=
"height:
93vh
;"
>
{% block content %}
{% block content %}
<div>
<div>
...
...
templates/layout/user_layout.html
View file @
2f08a104
{% load static %}
{% load static %}
<!DOCTYPE html>
<!DOCTYPE html>
<html>
<html
lang=
"en"
>
<head>
<head>
<meta
charset=
"utf-8"
>
<meta
charset=
"utf-8"
>
<meta
http-equiv=
"X-UA-Compatible"
content=
"IE=edge"
>
<meta
http-equiv=
"X-UA-Compatible"
content=
"IE=edge"
>
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1"
>
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1"
>
<title>
{{title}}
</title>
<title>
{{title}}
</title>
<link
rel=
"stylesheet"
href=
"https://unpkg.com/leaflet@1.7.1/dist/leaflet.css"
/>
<script
src=
"https://unpkg.com/leaflet@1.7.1/dist/leaflet.js"
></script>
<link
rel=
"stylesheet"
href=
"https://unpkg.com/leaflet.markercluster@1.4.1/dist/MarkerCluster.css"
>
<link
rel=
"stylesheet"
href=
"https://unpkg.com/leaflet.markercluster@1.4.1/dist/MarkerCluster.Default.css"
>
<link
rel=
"stylesheet"
href=
"https://cdn.jsdelivr.net/npm/leaflet.locatecontrol/dist/L.Control.Locate.min.css"
/>
<link
rel=
"stylesheet"
href=
"https://unpkg.com/leaflet-control-geocoder/dist/Control.Geocoder.css"
/>
<link
rel=
"stylesheet"
href=
"https://unpkg.com/esri-leaflet-geocoder@2.3.3/dist/esri-leaflet-geocoder.css"
>
<script
src=
"https://cdn.jsdelivr.net/npm/leaflet.locatecontrol/dist/L.Control.Locate.min.js"
charset=
"utf-8"
></script>
<!-- Global stylesheets -->
<link
href=
"https://fonts.googleapis.com/css?family=Roboto:400,300,100,500,700,900"
rel=
"stylesheet"
type=
"text/css"
>
<link
href=
"{% static 'css/icons/icomoon/styles.css' %}"
rel=
"stylesheet"
type=
"text/css"
>
<link
href=
"{% static 'css/bootstrap.css' %}"
rel=
"stylesheet"
type=
"text/css"
>
<link
href=
"{% static 'css/core.css' %}"
rel=
"stylesheet"
type=
"text/css"
>
<link
href=
"{% static 'css/components.css' %}"
rel=
"stylesheet"
type=
"text/css"
>
<link
href=
"{% static 'css/colors.css' %}"
rel=
"stylesheet"
type=
"text/css"
>
<script
src=
"{% static 'js/Leaflet.Editables.js' %}"
></script>
<!-- /global stylesheets -->
<style>
<style>
.page-container
{
padding
:
0
;
.page_loader
{
position
:
fixed
;
background
:
url('../../static/img/loadingz.gif')
50%
50%
no-repeat
rgb
(
249
,
249
,
249
);
left
:
0px
;
top
:
0px
;
width
:
100%
;
height
:
100%
;
height
:
100%
;
z-index
:
9999
;
}
opacity
:
.5
;
.modal-backdrop
{
z-index
:
-999
!important
;
}
.sidebar
{
padding
:
0
;
}
}
.form-group
{
margin-bottom
:
0px
;
}
hr
{
.panel-body
{
margin-top
:
0px
!important
;
padding
:
0px
20px
;
}
}
.leaflet-popup-content
{
.row
{
width
:
500px
;
margin-left
:
0px
;
margin-right
:
0px
;
}
}
.leaflet-control-attribution
{
th
{
display
:
none
;
min-width
:
150px
;
}
.modal-colors
{
background-color
:
#1a222f
;
}
.lbl-top
{
margin-top
:
10px
;
}
}
/* width */
::-webkit-scrollbar
{
::-webkit-scrollbar
{
width
:
5
px
;
width
:
10
px
;
}
}
/* Track */
/* Track */
...
@@ -46,268 +79,647 @@
...
@@ -46,268 +79,647 @@
/* Handle */
/* Handle */
::-webkit-scrollbar-thumb
{
::-webkit-scrollbar-thumb
{
background
:
#
bfbfbf
;
background
:
#
888
;
}
}
/* Handle on hover */
/* Handle on hover */
::-webkit-scrollbar-thumb:hover
{
::-webkit-scrollbar-thumb:hover
{
background
:
rgb
(
138
,
138
,
138
)
;
background
:
#555
;
}
}
</style>
</style>
</head>
{% include 'includes/css-o.html' %} {% include 'includes/css-m.html' %}
<body
style=
"padding-right: 0px !important;"
>
<link
rel=
"stylesheet"
href=
"https://unpkg.com/leaflet@1.7.1/dist/leaflet.css"
/>
<!-- Main navbar -->
<script
src=
"https://unpkg.com/leaflet@1.7.1/dist/leaflet.js"
></script>
<!-- Main navbar -->
<div
class=
"navbar navbar-inverse"
>
<div
class=
"navbar-header"
>
<a
class=
"navbar-brand"
href=
"{% url 'apps:dashboard' %}"
>
<!-- <h3>NationalAddress</h3> -->
<i
class=
" icon-location4"
></i>
<b>
OKU-GIS
</b>
</a>
<link
rel=
"stylesheet"
href=
"https://unpkg.com/leaflet.markercluster@1.4.1/dist/MarkerCluster.css
"
>
<ul
class=
"nav navbar-nav pull-right visible-xs-block
"
>
<link
rel=
"stylesheet"
href=
"https://unpkg.com/leaflet.markercluster@1.4.1/dist/MarkerCluster.Default.css"
>
<li><a
data-toggle=
"collapse"
data-target=
"#navbar-mobile"
><i
class=
"icon-tree5"
></i></a></li
>
<link
rel=
"stylesheet"
href=
"https://cdn.jsdelivr.net/npm/leaflet.locatecontrol/dist/L.Control.Locate.min.css"
/
>
</ul
>
<link
rel=
"stylesheet"
href=
"https://unpkg.com/leaflet-control-geocoder/dist/Control.Geocoder.css"
/
>
</div
>
<link
rel=
"stylesheet"
href=
"https://unpkg.com/esri-leaflet-geocoder@2.3.3/dist/esri-leaflet-geocoder.css
"
>
<div
class=
"navbar-collapse collapse"
id=
"navbar-mobile
"
>
<script
src=
"https://cdn.jsdelivr.net/npm/leaflet.locatecontrol/dist/L.Control.Locate.min.js"
charset=
"utf-8"
></script>
<p
class=
"navbar-text"
><span
class=
"label bg-success-400"
>
Online
</span></p>
<ul
class=
"nav navbar-nav navbar-right"
>
<li
class=
"dropdown dropdown-user"
>
<a
class=
"dropdown-toggle"
data-toggle=
"dropdown"
>
<img
src=
"{% static 'img/placeholder.jpg' %}"
alt=
""
>
<span>
{{user.username}}
</span>
<i
class=
"caret"
></i>
</a>
<!-- CSS Files -->
<ul
class=
"dropdown-menu dropdown-menu-right"
>
<link
href=
"{% static 'css/plugin.css'%}"
rel=
"stylesheet"
/>
<li><a
href=
"#"
><i
class=
"icon-user-plus"
></i>
My profile
</a></li>
<!-- CSS Just for demo purpose, don't include it in your project -->
<li><a
href=
"#"
><i
class=
"icon-cog5"
></i>
Account settings
</a></li>
<!-- <link href="{% static 'demo/demo.css'%}" rel="stylesheet" /> -->
<li
class=
"divider"
></li>
<!-- Global stylesheets -->
<li><a
href=
"{% url 'logout' %}"
><i
class=
"icon-cog5"
></i>
Logout
</a></li>
<link
href=
"https://fonts.googleapis.com/css?family=Roboto:400,300,100,500,700,900"
rel=
"stylesheet"
type=
"text/css"
>
</ul>
<link
href=
"{% static 'css/icons/icomoon/styles.css' %}"
rel=
"stylesheet"
type=
"text/css"
>
</li>
<link
href=
"{% static 'css/bootstrap.css' %}"
rel=
"stylesheet"
type=
"text/css"
>
</ul>
<link
href=
"{% static 'css/core.css' %}"
rel=
"stylesheet"
type=
"text/css"
>
</div>
<link
href=
"{% static 'css/components.css' %}"
rel=
"stylesheet"
type=
"text/css"
>
</div>
<link
href=
"{% static 'css/colors.css' %}"
rel=
"stylesheet"
type=
"text/css"
>
<!-- /main navbar -->
<script
src=
"{% static 'js/Leaflet.Editables.js' %}"
></script>
<style>
#button_hide_panel
{
line-height
:
30px
;
width
:
10px
;
font-size
:
10pt
;
font-family
:
tahoma
;
margin-top
:
0px
;
/* margin-right: 3px; */
position
:
absolute
;
/* top: 0; */
left
:
370px
;
z-index
:
998
;
display
:
none
;
}
#button_unhide_panel
{
line-height
:
30px
;
width
:
10px
;
font-size
:
10pt
;
font-family
:
tahoma
;
margin-top
:
0px
;
/* margin-right: 3px; */
position
:
absolute
;
/* top: 0; */
left
:
-11px
;
z-index
:
998
;
display
:
none
;
}
</style>
</head>
<!-- Page container -->
<div
class=
"page-container"
>
<body
>
<!-- Page content --
>
{% include 'includes/navbar.html' %}
<div
class=
"page-content"
>
{% block content %}
<!-- Main sidebar -->
<div
class=
"page-container"
>
<div
class=
"sidebar sidebar-main"
style=
"height: 95vh;
min-height: 607px;"
>
<div
class=
"sidebar-content"
style=
"height: 100%;"
>
<!-- Page content -->
<!-- User menu -->
<div
class=
"page-content"
>
<div
class=
"sidebar-user"
>
<div
class=
"category-content"
>
<!-- Main content -->
<div
class=
"media"
>
<div
class=
"content-wrapper"
>
<a
href=
"#"
class=
"media-left"
><img
src=
"assets/images/placeholder.jpg"
class=
"img-circle img-sm"
alt=
""
></a>
<div
class=
"panel panel-flat"
>
<div
class=
"media-body"
>
<div
class=
"panel-heading"
>
<span
class=
"media-heading text-semibold"
>
{{user.username}}
</span>
<h5
class=
"panel-title"
>
Page length options
</h5>
<div
class=
"text-size-mini text-muted"
>
<i
class=
"icon-pin text-size-small"
></i>
<div
class=
"heading-elements"
>
</div>
<ul
class=
"icons-list"
>
</div>
<li><a
data-action=
"collapse"
></a></li>
<li><a
data-action=
"reload"
></a></li>
<div
class=
"media-right media-middle"
>
<li><a
data-action=
"close"
></a></li>
<ul
class=
"icons-list"
>
</ul>
<li>
<a
href=
"#"
><i
class=
"icon-cog3"
></i></a>
</li>
</ul>
</div>
</div>
</div>
</div>
</div>
</div>
<hr>
<!-- /user menu -->
<div
class=
"panel-body"
>
<table
class=
"table datatable-show-all"
>
<thead>
<!-- Main navigation -->
<tr>
<div
class=
"sidebar-category sidebar-category-visible"
>
<th>
No.
</th>
<div
class=
"category-content no-padding"
>
<th>
Username
</th>
<ul
class=
"navigation navigation-main navigation-accordion"
>
<th>
Name
</th>
<th>
Email
</th>
<!-- Main -->
<th>
Status
</th>
<li
class=
"navigation-header"
>
<i
class=
"icon-menu"
title=
"Main pages"
></i></li>
<th
class=
"text-center"
>
Actions
</th>
<li><a
class=
"tablinks"
onclick=
"openInfo(event, 'info-maps')"
id=
"defaultOpen"
><span>
User Management
</span></a></li>
</tr>
<!-- <li><a class="tablinks" onclick="openInfo(event, 'info-penduduk')" id="defaultOpen"><span>Kependudukan</span></a></li>
</thead>
<li><a class="tablinks" onclick="openInfo(event, 'info-pendidikan')" id="defaultOpen"><span>Pendidikan</span></a></li>
<tbody>
<li><a class="tablinks" onclick="openInfo(event, 'info-pekerjaan')" id="defaultOpen"><span>Pekerjaan</span></a></li>
{% for user in data %}
<li><a class="tablinks" onclick="openInfo(event, 'info-poi')" id="defaultOpen"><span>POI</span></a></li> -->
<tr>
<td>
{{forloop.counter}}
</td>
</ul>
<td>
{{user.username}}
</td>
</li>
<td>
{{user.name}}
</td>
<!-- /page kits -->
<td>
{{user.email}}
</td>
<td>
</ul>
{% if user.isactive == t %}
<span
class=
"label label-success"
>
Active
</span>
{% else %}
<span
class=
"label label-success"
>
Active
</span>
{% endif %}
</td>
<td
class=
"text-center"
>
<ul
class=
"icons-list"
>
<li
class=
"dropdown"
>
<a
href=
"#"
class=
"dropdown-toggle"
data-toggle=
"dropdown"
>
<i
class=
"icon-menu9"
></i>
</a>
<ul
class=
"dropdown-menu dropdown-menu-right"
>
<li><a
href=
"#"
><i
class=
"icon-file-pdf"
></i>
Export to .pdf
</a></li>
<li><a
href=
"#"
><i
class=
"icon-file-excel"
></i>
Export to .csv
</a></li>
<li><a
href=
"#"
><i
class=
"icon-file-word"
></i>
Export to .doc
</a></li>
</ul>
</li>
</ul>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
</div>
</div>
<!-- /main navigation -->
</div>
</div>
<div
id=
"modal-adds"
class=
"modal fade"
data-keyboard=
"true"
>
</div>
<div
class=
"modal-dialog"
>
<!-- /main sidebar -->
<div
class=
"modal-content"
>
<div
class=
"modal-header"
>
<h6
class=
"modal-title"
>
Tambah user
</h6>
<!-- Main content -->
</div>
<div
class=
"content-wrapper"
id=
"info-maps"
>
<div>
<div
class=
"modal-body"
>
<!-- Page header -->
<div
class=
"page-header page-header-default"
style=
"margin-bottom: 0px;"
>
<input
id=
"idkps"
value=
""
type=
"hidden"
class=
"form-control"
placeholder=
"Nama Perusahaan.."
>
<div
class=
"breadcrumb-line"
>
<div
class=
"form-group"
>
<ul
class=
"breadcrumb"
>
<label>
Keterangan :
</label>
<li>
User Management
</li>
<textarea
id=
"keterangans"
cols=
"30"
rows=
"10"
type=
"text"
class=
"form-control"
placeholder=
"Keterangan Mahasiswa..."
></textarea>
</ul>
</div>
</div>
</div>
<!-- /page header -->
<!-- Content area -->
<div
class=
"content"
style=
"padding: 15px;"
>
<!-- Main charts -->
<!-- Sales stats -->
<div
class=
"panel panel-flat"
>
<div
class=
"panel-heading"
>
<h6
class=
"panel-title"
>
Table User
</h6>
<button
id=
"modalAddButton"
class=
"btn btn-primary btn-sm"
value=
"SAVE"
style=
"bottom: 15px; float: right; display:none;"
data-toggle=
"modal"
data-target=
"#modal_theme_info"
></button>
</div>
</div>
<div
class=
"modal-footer"
>
<hr
style=
"margin-top: 0px;"
>
<button
type=
"button"
class=
"btn btn-link"
data-dismiss=
"modal"
>
Close
</button>
<div
class=
"panel-body"
>
<button
id=
"btn-note"
name=
"validate"
value=
"105"
type=
"button"
class=
"btn btn-primary"
>
Tambah Keterangan
</button>
<table
class=
"table table-responsive datatable-show-all"
id=
"userList"
>
<thead>
<tr>
<th>
No.
</th>
<th>
Username
</th>
<th>
Name
</th>
<th>
Email
</th>
<th>
Last login
</th>
<th>
Status
</th>
<th
class=
"text-center"
>
Actions
</th>
</tr>
</thead>
<tbody>
{% for user in data %}
<tr>
<td>
{{forloop.counter}}
</td>
<td>
{{user.username}}
</td>
<td>
{{user.name}}
</td>
<td>
{{user.email}}
</td>
<td>
{{user.last}}
</td>
<td>
{% if user.isactive == True %}
<span
class=
"label label-success"
>
Active
</span>
{% else %}
<span
class=
"label label-danger"
>
Inactive
</span>
{% endif %}
</td>
<td
class=
"text-center"
>
<ul
class=
"icons-list"
>
<li
class=
"dropdown"
>
<a
href=
"#"
class=
"dropdown-toggle"
data-toggle=
"dropdown"
>
<i
class=
"icon-menu9"
></i>
</a>
<ul
class=
"dropdown-menu dropdown-menu-right"
>
<li><a
onclick=
"switchuserstatus('{{user.id}}, {{user.isactive}}')"
><i
class=
"icon-user-block"
></i>
Switch user status
</a></li>
<li><a
onclick=
"loaduserbyid('{{user.id}}')"
><i
class=
"icon-users"
></i>
Edit user
</a></li>
</ul>
</li>
</ul>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
<!-- /form validation -->
</div>
</div>
</div>
</div>
<!-- /main charts -->
</div>
</div>
</div>
</div>
<!-- /main content -->
</div>
</div>
{% endblock content %}
<!-- /page content -->
</div>
<!-- /page container -->
<div
id=
"modal_theme_info"
class=
"modal fade"
>
<div
class=
"modal-dialog md"
>
<div
class=
"modal-content"
>
<div
class=
"modal-header bg-info"
style=
"background-color: #1a222f !important;"
>
<button
type=
"button"
class=
"close"
data-dismiss=
"modal"
onclick=
"destroyfade()"
>
×
</button>
<h6
class=
"modal-title modstit"
>
Modal Tambah User
</h6>
</div>
<div
class=
"modal-body"
style=
"max-height: 450px;overflow-y: auto;"
>
<input
type=
"hidden"
id=
"iduser"
>
<div
class=
"form-group"
>
<label
class=
"col-lg-3 control-label lbl-top"
>
Username
</label>
<div
class=
"col-lg-9"
>
<input
id=
"inUsername"
type=
"text"
class=
"form-control"
value=
""
required
>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"col-lg-3 control-label lbl-top"
>
First Name
</label>
<div
class=
"col-lg-9"
>
<input
id=
"inNameF"
type=
"text"
class=
"form-control"
value=
""
required
>
</div>
</div>
<!-- <div id="map"></div> -->
<div
class=
"form-group"
>
<label
class=
"col-lg-3 control-label lbl-top"
>
Last Name
</label>
<div
class=
"col-lg-9"
>
<input
id=
"inNameL"
type=
"text"
class=
"form-control"
value=
""
required
>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"col-lg-3 control-label lbl-top"
>
Email
</label>
<div
class=
"col-lg-9"
>
<input
id=
"inEmail"
type=
"text"
class=
"form-control"
value=
""
required
>
</div>
</div>
<div
class=
"form-group"
style=
"margin-top: 10px !important;"
>
<label
class=
"col-lg-3 control-label lbl-top"
>
Groups
</label>
<div
class=
"col-lg-9"
>
<select
style=
"border-bottom: 1px solid rgb(83, 83, 83) !important;"
id=
"select_group"
multiple=
"multiple"
data-placeholder=
"select group.."
class=
"select-size-xs"
>
<option></option>
</select>
</div>
</div>
</div>
<hr>
<div
class=
"modal-footer"
>
<button
type=
"button"
class=
"btn btn-link"
data-dismiss=
"modal"
onclick=
"destroyfade()"
>
Close
</button>
<button
type=
"button"
class=
"btn btn-info"
id=
"saveuser"
>
Save changes
</button>
</div>
</div>
</div>
</div>
<div
class=
"modal fade"
id=
"modal-kelurahan"
tabindex=
"-1"
role=
"dialog"
>
</div>
<!-- end modal location -->
<!-- Core JS files -->
{% include 'includes/modal.html' %}
<script
type=
"text/javascript"
src=
"{% static 'js/plugins/loaders/pace.min.js' %}"
></script>
<script
type=
"text/javascript"
src=
"{% static 'js/core/libraries/jquery.min.js' %}"
></script>
<script
type=
"text/javascript"
src=
"{% static 'js/core/libraries/bootstrap.min.js' %}"
></script>
<script
type=
"text/javascript"
src=
"{% static 'js/plugins/loaders/blockui.min.js' %}"
></script>
<script
type=
"text/javascript"
src=
"{% static 'js/plugins/ui/nicescroll.min.js' %}"
></script>
<script
type=
"text/javascript"
src=
"{% static 'js/plugins/ui/drilldown.js' %}"
></script>
<!-- /core JS files -->
<script
src=
"https://use.fontawesome.com/d232835e93.js"
></script>
<div
class=
"page_loader"
></div>
<script
src=
"https://unpkg.com/leaflet.markercluster@1.4.1/dist/leaflet.markercluster.js"
></script>
<!-- <script src="https://cdn.jsdelivr.net/npm/leaflet.locatecontrol/dist/L.Control.Locate.min.js" charset="utf-8"></script>
<script src="https://cdn.jsdelivr.net/npm/leaflet.locatecontrol/dist/L.Control.Locate.min.js" charset="utf-8"></script> -->
<script
src=
"https://unpkg.com/esri-leaflet@2.5.1/dist/esri-leaflet.js"
></script>
<script
src=
"https://unpkg.com/esri-leaflet-geocoder@2.3.3/dist/esri-leaflet-geocoder.js"
></script>
<script
src=
"https://unpkg.com/leaflet-control-geocoder/dist/Control.Geocoder.js"
></script>
<script
src=
"https://code.jquery.com/jquery-3.5.1.js"
></script>
<script
src=
"https://code.jquery.com/ui/1.12.1/jquery-ui.js"
></script>
<script
src=
"https://cdnjs.cloudflare.com/ajax/libs/leaflet.draw/1.0.4/leaflet.draw-src.js"
></script>
<script
src=
"https://cdnjs.cloudflare.com/ajax/libs/list.js/1.5.0/list.min.js"
></script>
<script
src=
"https://cdnjs.cloudflare.com/ajax/libs/handlebars.js/4.7.6/handlebars.min.js"
></script>
<script
src=
"https://cdnjs.cloudflare.com/ajax/libs/typeahead.js/0.11.1/typeahead.bundle.min.js"
></script>
<script
src=
"https://cdnjs.cloudflare.com/ajax/libs/leaflet.fullscreen/1.4.2/Control.FullScreen.min.js"
></script>
<!-- Theme JS files -->
<!-- Theme JS files -->
<script
type=
"text/javascript"
src=
"{% static 'js/plugins/visualization/d3/d3.min.js' %}"
></script>
<script
type=
"text/javascript"
src=
"{% static 'js/plugins/visualization/d3/d3_tooltip.js' %}"
></script>
<script
type=
"text/javascript"
src=
"{% static 'js/plugins/forms/styling/switchery.min.js' %}"
></script>
<script
type=
"text/javascript"
src=
"{% static 'js/plugins/forms/styling/uniform.min.js' %}"
></script>
<script
type=
"text/javascript"
src=
"{% static 'js/plugins/forms/selects/bootstrap_multiselect.js' %}"
></script>
<script
type=
"text/javascript"
src=
"{% static 'js/plugins/ui/moment/moment.min.js' %}"
></script>
<script
type=
"text/javascript"
src=
"{% static 'js/plugins/pickers/daterangepicker.js' %}"
></script>
<!-- <script type="text/javascript" src="{% static 'js/plugins/ui/ripple.min.js' %}"></script> -->
<!-- /theme JS files -->
{% include 'includes/scripts.html' %}
{% include 'includes/scripts.html' %}
<script
src=
"{% static 'js/leaflet-bing-layer.js' %}"
></script>
<!-- <script src="https://unpkg.com/sweetalert/dists/sweetalert.min.js"></script> -->
<script
type=
"text/javascript"
src=
"{% static 'js/core/libraries/jquery_ui/interactions.min.js' %}"
></script>
<script
type=
"text/javascript"
src=
"{% static 'js/plugins/forms/selects/select2.min.js' %}"
></script>
<script
type=
"text/javascript"
src=
"{% static 'js/pages/form_select2.js' %}"
></script>
</body>
<!-- <script type="text/javascript" src="{% static 'js/pages/datatables_advanced.js'%}"></script> -->
<script
type=
"text/javascript"
src=
"{% static 'js/plugins/forms/selects/select2.min.js' %}"
></script>
</html>
<!-- /theme JS files -->
<script>
// file.onchange = evt => {
// const [fil] = file.files
// if (fil) {
// blah.src = URL.createObjectURL(fil)
// }
// }
<script
type=
"text/javascript"
>
jQuery
(
document
).
ajaxSend
(
function
(
event
,
xhr
,
settings
)
{
function
getCookie
(
name
)
{
var
cookieValue
=
null
;
if
(
document
.
cookie
&&
document
.
cookie
!=
''
)
{
var
cookies
=
document
.
cookie
.
split
(
'
;
'
);
for
(
var
i
=
0
;
i
<
cookies
.
length
;
i
++
)
{
var
cookie
=
jQuery
.
trim
(
cookies
[
i
]);
// Does this cookie string begin with the name we want?
if
(
cookie
.
substring
(
0
,
name
.
length
+
1
)
==
(
name
+
'
=
'
))
{
cookieValue
=
decodeURIComponent
(
cookie
.
substring
(
name
.
length
+
1
));
break
;
}
}
}
return
cookieValue
;
}
function
sameOrigin
(
url
)
{
// url could be relative or scheme relative or absolute
var
host
=
document
.
location
.
host
;
// host + port
var
protocol
=
document
.
location
.
protocol
;
var
sr_origin
=
'
//
'
+
host
;
var
origin
=
protocol
+
sr_origin
;
// Allow absolute or scheme relative URLs to same origin
return
(
url
==
origin
||
url
.
slice
(
0
,
origin
.
length
+
1
)
==
origin
+
'
/
'
)
||
(
url
==
sr_origin
||
url
.
slice
(
0
,
sr_origin
.
length
+
1
)
==
sr_origin
+
'
/
'
)
||
// or any other URL that isn't scheme relative or absolute i.e relative.
!
(
/^
(\/\/
|http:|https:
)
.*/
.
test
(
url
));
}
function
safeMethod
(
method
)
{
return
(
/^
(
GET|HEAD|OPTIONS|TRACE
)
$/
.
test
(
method
));
}
if
(
!
safeMethod
(
settings
.
type
)
&&
sameOrigin
(
settings
.
url
))
{
xhr
.
setRequestHeader
(
"
X-CSRFToken
"
,
getCookie
(
'
csrftoken
'
));
}
});
function
openInfo
(
evt
,
infName
)
{
var
i
,
tabcontent
,
tablinks
;
tabcontent
=
document
.
getElementsByClassName
(
"
content-wrapper
"
);
for
(
i
=
0
;
i
<
tabcontent
.
length
;
i
++
)
{
tabcontent
[
i
].
style
.
display
=
"
none
"
;
}
tablinks
=
document
.
getElementsByClassName
(
"
tablinks
"
);
for
(
i
=
0
;
i
<
tablinks
.
length
;
i
++
)
{
tablinks
[
i
].
className
=
tablinks
[
i
].
className
.
replace
(
"
active
"
,
""
);
}
document
.
getElementById
(
infName
).
style
.
display
=
"
block
"
;
evt
.
currentTarget
.
className
+=
"
active
"
;
}
function
destroyfade
(){
$
(
"
.modal-backdrop
"
).
css
(
"
display
"
,
"
none
"
)
$
(
"
.modal-backdrop
"
).
removeClass
(
'
show
'
);
$
(
"
body
"
).
css
(
'
padding-right
'
,
'
0px !important
'
)
}
$
(
'
.datatable-show-all
'
).
DataTable
({
autoWidth
:
false
,
columnDefs
:
[{
orderable
:
false
,
width
:
'
100px
'
,
targets
:
[
5
]
}],
dom
:
'
<"float-left"B>frtip
'
,
buttons
:
[
{
text
:
'
Tambah User
'
,
action
:
function
(
e
,
dt
,
node
,
config
)
{
$
(
"
#modalAddButton
"
).
click
()
$
(
"
#inUsername
"
).
attr
(
"
disabled
"
,
false
);
$
(
"
#inUsername
"
).
val
(
null
);
$
(
"
#inNameF
"
).
val
(
null
);
$
(
"
#inNameL
"
).
val
(
null
);
$
(
"
#inEmail
"
).
val
(
null
);
$
(
"
#iduser
"
).
val
(
null
);
$
(
"
.modstit
"
).
html
(
"
Tambah User
"
)
loadGroups
(
null
)
}
}
],
language
:
{
search
:
'
<span>Filter:</span> _INPUT_
'
,
searchPlaceholder
:
'
Type to filter...
'
,
lengthMenu
:
'
<span>Show:</span> _MENU_
'
,
paginate
:
{
'
first
'
:
'
First
'
,
'
last
'
:
'
Last
'
,
'
next
'
:
'
→
'
,
'
previous
'
:
'
←
'
}
},
drawCallback
:
function
()
{
$
(
this
).
find
(
'
tbody tr
'
).
slice
(
-
3
).
find
(
'
.dropdown, .btn-group
'
).
addClass
(
'
dropup
'
);
},
preDrawCallback
:
function
()
{
$
(
this
).
find
(
'
tbody tr
'
).
slice
(
-
3
).
find
(
'
.dropdown, .btn-group
'
).
removeClass
(
'
dropup
'
);
}
// console.log(result_);
});
loaderPage
(
false
);
function
loaderPage
(
stat
)
{
$
(
"
#modalAddButton
"
).
click
(
function
(){
if
(
stat
==
true
)
{
$
(
"
body
"
).
css
(
"
padding-right
"
,
"
0px !important
"
)
$
(
'
.page_loader
'
).
show
();
})
}
else
{
$
(
'
.page_loader
'
).
hide
();
$
(
"
#saveuser
"
).
on
(
"
click
"
,
function
(){
addUser
()
})
function
addUser
(){
var
isObject
=
{};
var
ars
=
''
var
group
=
$
(
"
#select_group
"
).
val
();
var
iduser
=
$
(
"
#iduser
"
).
val
();
if
(
iduser
){
isObject
.
id
=
iduser
;
}
for
(
i
in
group
){
if
(
i
<
group
.
length
-
1
){
ars
+=
group
[
i
]
+
"
~
"
;
}
else
{
ars
+=
group
[
i
];
}
}
};
}
isObject
[
'
username
'
]
=
$
(
"
#inUsername
"
).
val
();
isObject
[
'
first_name
'
]
=
$
(
"
#inNameF
"
).
val
();
isObject
[
'
last_name
'
]
=
$
(
"
#inNameL
"
).
val
();
isObject
[
'
email
'
]
=
$
(
"
#inEmail
"
).
val
();
isObject
.
group
=
ars
console
.
log
(
isObject
);
// return false
$
.
ajax
({
url
:
"
{% url 'adduser' %}
"
,
data
:
isObject
,
dataType
:
'
json
'
,
type
:
'
post
'
,
success
:
function
(
data
)
{
let
response
=
data
;
if
(
response
.
code
==
0
){
$
(
"
#modal_theme_info
"
).
modal
(
'
toggle
'
);
destroyfade
();
$
(
function
(){
swal
({
$
.
extend
(
$
.
fn
.
dataTable
.
defaults
,
{
title
:
response
.
info
,
text
:
response
.
data
,
type
:
"
success
"
,
icon
:
"
success
"
,
confirmButtonColor
:
"
#00BCD4
"
}).
then
((
isok
)
=>
{
location
.
reload
();
})
}
else
{
swal
({
title
:
response
.
info
,
text
:
response
.
data
,
type
:
"
alert
"
,
icon
:
"
error
"
,
confirmButtonColor
:
"
#00BCD4
"
})
}
}
});
}
$
(
"
#select_group
"
).
on
(
"
click
"
,
function
(
e
){
e
.
preventDefault
()
})
function
loadGroups
(
isSelect
){
var
isObject
=
{}
console
.
log
(
isSelect
)
isObject
.
func_name
=
"
loadGroups
"
;
$
.
ajax
({
url
:
"
{% url 'getallGroups' %}
"
,
data
:
isObject
,
dataType
:
'
json
'
,
type
:
'
post
'
,
success
:
function
(
data
)
{
});
let
response
=
data
;
console
.
log
(
response
)
$
(
'
.datatable-show-all
'
).
DataTable
({
if
(
response
.
code
==
0
){
autoWidth
:
false
,
var
groups
=
response
.
data
;
columnDefs
:
[{
var
html
=
``
;
orderable
:
false
,
for
(
i
in
groups
){
width
:
'
100px
'
,
if
(
isSelect
){
targets
:
[
5
]
if
(
isSelect
.
length
>=
1
){
}],
for
(
j
in
isSelect
){
dom
:
'
<"float-left"B>lfrtip
'
,
if
(
isSelect
[
j
]
==
groups
[
i
]){
buttons
:
[
html
+=
`<option value="`
+
groups
[
i
]
+
`" selected>`
+
groups
[
i
]
+
`</option>`
;
{
}
else
{
text
:
'
My button
'
,
html
+=
`<option value="`
+
groups
[
i
]
+
`">`
+
groups
[
i
]
+
`</option>`
;
action
:
function
(
e
,
dt
,
node
,
config
)
{
}
showmodal
()
}
}
else
{
html
+=
`<option value="`
+
groups
[
i
]
+
`">`
+
groups
[
i
]
+
`</option>`
;
}
}
else
{
html
+=
`<option value="`
+
groups
[
i
]
+
`">`
+
groups
[
i
]
+
`</option>`
;
}
}
}
}
],
language
:
{
$
(
"
#select_group
"
).
html
(
html
);
search
:
'
<span>Filter:</span> _INPUT_
'
,
}
else
{
searchPlaceholder
:
'
Type to filter...
'
,
$
(
"
#select_group
"
).
html
(
"
group tidak tersedia
"
);
lengthMenu
:
'
<span>Show:</span> _MENU_
'
,
paginate
:
{
'
first
'
:
'
First
'
,
'
last
'
:
'
Last
'
,
'
next
'
:
'
→
'
,
'
previous
'
:
'
←
'
}
},
drawCallback
:
function
()
{
$
(
this
).
find
(
'
tbody tr
'
).
slice
(
-
3
).
find
(
'
.dropdown, .btn-group
'
).
addClass
(
'
dropup
'
);
},
preDrawCallback
:
function
()
{
$
(
this
).
find
(
'
tbody tr
'
).
slice
(
-
3
).
find
(
'
.dropdown, .btn-group
'
).
removeClass
(
'
dropup
'
);
}
}
}
});
});
})
}
function
showmodal
(){
function
switchuserstatus
(
id
,
isactive
){
$
(
"
#modal-adds
"
).
modal
(
"
show
"
)
var
isObject
=
{}
var
params
=
id
.
split
(
"
,
"
);
isObject
.
id
=
params
[
0
];
isObject
.
stat
=
params
[
1
].
replace
(
"
"
,
""
);
console
.
log
(
params
)
if
(
isObject
.
stat
==
"
True
"
){
var
title
=
"
Nonaktifkan
"
;
var
text
=
"
User tidak akan bisa login jika dinonaktifkan!
"
;
}
else
{
var
title
=
"
Aktifkan
"
;
var
text
=
"
User dapat kembali login jika diaktifkan!
"
;
}
}
swal
({
title
:
title
+
"
user?
"
,
text
:
text
,
type
:
"
warning
"
,
showCancelButton
:
true
,
confirmButtonClass
:
"
btn-danger
"
,
confirmButtonText
:
"
Ya!
"
,
cancelButtonText
:
"
Tidak!
"
,
closeOnConfirm
:
false
,
closeOnCancel
:
false
}).
then
((
isConfirm
)
=>
{
console
.
log
(
isConfirm
)
if
(
isConfirm
.
value
)
{
$
.
ajax
({
url
:
"
{% url 'switchStatus' %}
"
,
data
:
isObject
,
dataType
:
'
json
'
,
type
:
'
post
'
,
success
:
function
(
data
)
{
let
response
=
data
;
</script>
if
(
isObject
.
stat
==
"
True
"
){
var
inf
=
"
dinonaktifkan
"
}
else
{
var
inf
=
"
diaktifkan
"
}
if
(
response
.
code
==
0
){
swal
({
title
:
"
sukses
"
,
text
:
"
User berhasil
"
+
inf
,
type
:
"
success
"
,
icon
:
"
success
"
,
confirmButtonColor
:
"
#00BCD4
"
}).
then
((
isok
)
=>
{
location
.
reload
();
})
}
else
{
alert
(
"
no data in database
"
)
}
}
});
}
else
{
swal
(
"
Dibatalkan
"
,
"
User status tidak berubah
"
,
"
error
"
);
}
});
}
function
loaduserbyid
(
id
){
var
isObject
=
{};
$
(
"
.modstit
"
).
html
(
"
Update User
"
)
$
(
"
#inUsername
"
).
attr
(
"
disabled
"
,
true
)
</body>
isObject
.
id
=
id
;
$
(
"
#iduser
"
).
val
(
id
)
</html>
$
.
ajax
({
url
:
"
{% url 'loadUserbyId' %}
"
,
data
:
isObject
,
dataType
:
'
json
'
,
type
:
'
post
'
,
success
:
function
(
data
)
{
let
response
=
data
;
if
(
response
.
code
==
0
){
var
user
=
response
.
data
;
console
.
log
(
user
)
$
(
"
#inUsername
"
).
val
(
user
.
username
);
$
(
"
#inNameF
"
).
val
(
user
.
firstname
);
$
(
"
#inNameL
"
).
val
(
user
.
lastname
);
$
(
"
#inEmail
"
).
val
(
user
.
email
);
loadGroups
(
user
.
group
)
$
(
"
#modalAddButton
"
).
click
()
}
else
{
}
}
});
}
</script>
\ No newline at end of file
templates/maps/e.html
View file @
2f08a104
...
@@ -124,7 +124,7 @@
...
@@ -124,7 +124,7 @@
<div
class=
"page-content"
>
<div
class=
"page-content"
>
<!-- Main sidebar -->
<!-- Main sidebar -->
<div
class=
"sidebar sidebar-main"
style=
"height:
607px
;
<div
class=
"sidebar sidebar-main"
style=
"height:
95vh
;
min-height: 607px;"
>
min-height: 607px;"
>
<div
class=
"sidebar-content"
style=
"height: 100%;"
>
<div
class=
"sidebar-content"
style=
"height: 100%;"
>
...
...
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