Commit 4d5698da authored by Manggar Mahardhika's avatar Manggar Mahardhika

men2 terakhir

parent 495122ee
...@@ -3277,13 +3277,31 @@ def user_data(request): ...@@ -3277,13 +3277,31 @@ def user_data(request):
} }
point.append(datap) point.append(datap)
with conn.cursor() as grup:
grup.execute("""
SELECT id, name from auth_group
""")
grp = grup.fetchall()
group = []
for g in grp:
datag = {
"id":g[0],
"name":g[1]
}
group.append(datag)
respon = { respon = {
'data' : user_res, 'data' : user_res,
'thisUser' : user_data, 'thisUser' : user_data,
'point':point 'point':point,
'group':group,
} }
return Response(respon) return Response(respon)
@api_view(('GET',)) @api_view(('GET',))
def search_spes(request): def search_spes(request):
tipe = request.GET.get('type') tipe = request.GET.get('type')
......
...@@ -838,9 +838,10 @@ def saveperbaikan(request): ...@@ -838,9 +838,10 @@ def saveperbaikan(request):
pj_lapangan = request.POST.get("pj_lapangan") pj_lapangan = request.POST.get("pj_lapangan")
kontraktor = request.POST.get("kontraktor") kontraktor = request.POST.get("kontraktor")
pjg_perbaikan = request.POST.get("pjg_perbaikan") pjg_perbaikan = request.POST.get("pjg_perbaikan")
sumber_dana = request.POST.get("sumber_dana")
lbr_perbaikan = request.POST.get("lbr_perbaikan") lbr_perbaikan = request.POST.get("lbr_perbaikan")
jenis_perbaikan = request.POST.get("jenis_perbaikan") jenis_perbaikan = request.POST.get("jenis_perbaikan")
luas = request.POST.get("luas") # luas = request.POST.get("luas")
coor = request.POST.get("coord") coor = request.POST.get("coord")
tgl_selesai = request.POST.get("tgl_selesai") tgl_selesai = request.POST.get("tgl_selesai")
...@@ -856,7 +857,7 @@ def saveperbaikan(request): ...@@ -856,7 +857,7 @@ def saveperbaikan(request):
pjg_perbaikan = re.sub('[^0-9.]+', '', str(pjg_perbaikan)) pjg_perbaikan = re.sub('[^0-9.]+', '', str(pjg_perbaikan))
lbr_perbaikan = re.sub('[^0-9.]+', '', str(lbr_perbaikan)) lbr_perbaikan = re.sub('[^0-9.]+', '', str(lbr_perbaikan))
luas = re.sub('[^0-9.]+', '', str(luas)) # luas = re.sub('[^0-9.]+', '', str(luas))
# if coord['features'][0]['geometry']['type'] == 'LineString': # if coord['features'][0]['geometry']['type'] == 'LineString':
# print("oke") # print("oke")
...@@ -925,6 +926,7 @@ def saveperbaikan(request): ...@@ -925,6 +926,7 @@ def saveperbaikan(request):
pjg_perbaikan, pjg_perbaikan,
lbr_perbaikan, lbr_perbaikan,
jenis_perbaikan, jenis_perbaikan,
sumber_dana,
geom geom
) )
VALUES VALUES
...@@ -945,6 +947,7 @@ def saveperbaikan(request): ...@@ -945,6 +947,7 @@ def saveperbaikan(request):
%s, %s,
%s, %s,
'%s', '%s',
'%s',
ST_GeomFromText('%s') ST_GeomFromText('%s')
) )
"""% ( """% (
...@@ -964,6 +967,7 @@ def saveperbaikan(request): ...@@ -964,6 +967,7 @@ def saveperbaikan(request):
float(pjg_perbaikan), float(pjg_perbaikan),
float(lbr_perbaikan), float(lbr_perbaikan),
jenis_perbaikan, jenis_perbaikan,
sumber_dana,
corcoran)) corcoran))
conn.commit() conn.commit()
data = "Sukses" data = "Sukses"
......
...@@ -89,6 +89,8 @@ DATABASES = { ...@@ -89,6 +89,8 @@ DATABASES = {
'PORT': '5432', 'PORT': '5432',
# 'HOST': '103.126.28.66', # 'HOST': '103.126.28.66',
# 'PORT': '8082', # 'PORT': '8082',
# 'HOST': '125.164.19.183',
# 'PORT': '5432',
} }
} }
......
...@@ -33,6 +33,7 @@ urlpatterns = [ ...@@ -33,6 +33,7 @@ urlpatterns = [
path('getallGroups/', views.listGroup, name="getallGroups"), path('getallGroups/', views.listGroup, name="getallGroups"),
path('switchStatus/', views.deactivateUser, name="switchStatus"), path('switchStatus/', views.deactivateUser, name="switchStatus"),
path('loadUserbyId/', views.loadUserbyId, name="loadUserbyId"), path('loadUserbyId/', views.loadUserbyId, name="loadUserbyId"),
path('loadgroup/', views.load_group_edit, name="loadgroup"),
path('addGroup/', views.addGroup, name="addGroup"), path('addGroup/', views.addGroup, name="addGroup"),
path('deleteGroup/', views.deleteGroup, name="deleteGroup"), path('deleteGroup/', views.deleteGroup, name="deleteGroup"),
path('getGroupById/', views.loadGroupByGroupId, name='getGroupById'), path('getGroupById/', views.loadGroupByGroupId, name='getGroupById'),
......
...@@ -446,6 +446,37 @@ def loadUserbyId(request): ...@@ -446,6 +446,37 @@ def loadUserbyId(request):
return Response(data) return Response(data)
@api_view(('POST',))
def load_group_edit(request):
if request.method == "POST":
idgroup = request.POST.get('id')
with conn.cursor() as cursor:
cursor.execute("SELECT a.id, a.name, b.name from auth_group a left join auth_group b on b.id = a.have_parent where a.id = "+idgroup+"")
result = cursor.fetchall()
resgroup = []
# if result[0][2] != None:
# group_res = loadGroupById(id)
# print(group_res)
# print(result[0][2])
# group_res = loadGroupById(id)
for i in result:
datas = {
"id" : i[0],
"name" : i[1],
"parent": i[2]
}
resgroup.append(datas)
print(datas)
data = {
"info" : "success",
"code" : 0,
"data" : datas,
}
return Response(data)
def loadGroupById(iduser): def loadGroupById(iduser):
with conn.cursor() as cursor: with conn.cursor() as cursor:
...@@ -467,15 +498,17 @@ def addGroup(request): ...@@ -467,15 +498,17 @@ def addGroup(request):
name = request.POST.get('name') name = request.POST.get('name')
idgroup = request.POST.get('id') idgroup = request.POST.get('id')
parent = request.POST.get('parent') parent = request.POST.get('parent')
print(parent)
if parent != None: if parent != '':
for s in Group.objects.all(): for s in Group.objects.all():
if s.name == parent: if s.name == parent:
userGroup = s.id userGroup = s.id
print(userGroup)
else: else:
for g in request.user.groups.all(): for g in request.user.groups.all():
userGroup = g.id userGroup = g.id
# # print(userGroup) print(userGroup)
try: try:
if idgroup: if idgroup:
with conn.cursor() as cursor: with conn.cursor() as cursor:
...@@ -487,9 +520,10 @@ def addGroup(request): ...@@ -487,9 +520,10 @@ def addGroup(request):
# print("ini parent ya gan") # print("ini parent ya gan")
# print(len(result)) # print(len(result))
if isParent == None: # print(isParent)
if parent == '':
with conn.cursor() as cursor: with conn.cursor() as cursor:
cursor.execute("UPDATE auth_group SET name = '"+name+"' WHERE id="+str(idgroup)) cursor.execute("UPDATE auth_group SET name = '"+name+"', have_parent = NULL WHERE id="+str(idgroup))
result = cursor.rowcount result = cursor.rowcount
else: else:
with conn.cursor() as cursor: with conn.cursor() as cursor:
...@@ -518,10 +552,15 @@ def addGroup(request): ...@@ -518,10 +552,15 @@ def addGroup(request):
} }
except Group.DoesNotExist: except Group.DoesNotExist:
if parent == '':
with conn.cursor() as cursor:
cursor.execute("INSERT INTO auth_group(name) VALUES ('"+name+"')")
result = cursor.rowcount
else:
with conn.cursor() as cursor: with conn.cursor() as cursor:
cursor.execute("INSERT INTO auth_group(name, have_parent) VALUES ('"+name+"', "+str(userGroup)+")") cursor.execute("INSERT INTO auth_group(name, have_parent) VALUES ('"+name+"', "+str(userGroup)+")")
result = cursor.rowcount result = cursor.rowcount
if result > 0: if result > 0:
data = { data = {
"code" : 0, "code" : 0,
......
<?xml version="1.0" encoding="UTF-8"?>
<svg width="752pt" height="752pt" version="1.1" viewBox="0 0 752 752" xmlns="http://www.w3.org/2000/svg">
<g fill="#3f3f3f">
<path d="m376 372.21c-40.727 0-73.879-33.152-73.879-73.879 0-40.727 33.152-73.875 73.879-73.875s73.879 33.152 73.879 73.879c0 40.727-33.148 73.875-73.879 73.875zm0-119.34c-25.102 0-45.465 20.363-45.465 45.465 0 25.102 20.363 45.465 45.465 45.465s45.465-20.363 45.465-45.465c0-25.102-20.363-45.465-45.465-45.465z"/>
<path d="m513.81 377.89c-29.836 0-53.988-24.152-53.988-53.988s24.152-53.988 53.988-53.988 53.988 24.152 53.988 53.988-24.152 53.988-53.988 53.988zm0-79.559c-14.207 0-25.574 11.367-25.574 25.574 0 14.207 11.367 25.574 25.574 25.574s25.574-11.367 25.574-25.574c0-14.211-11.367-25.574-25.574-25.574z"/>
<path d="m238.19 377.89c-29.836 0-53.988-24.152-53.988-53.988s24.152-53.988 53.988-53.988 53.988 24.152 53.988 53.988-24.152 53.988-53.988 53.988zm0-79.559c-14.207 0-25.574 11.367-25.574 25.574 0 14.207 11.367 25.574 25.574 25.574s25.574-11.367 25.574-25.574c0-14.211-11.363-25.574-25.574-25.574z"/>
<path d="m514.29 482.56c-19.418 0-31.73-0.94531-41.676-2.3672l-11.84-1.8945v-13.734c0-18.469-5.6836-36.938-17.051-53.516l-4.7344-7.1055 3.7891-7.5781c14.207-27.941 41.676-46.41 71.039-46.41 43.098 0 80.508 38.832 80.98 85.246 0.003906 47.359-44.516 47.359-80.508 47.359zm-25.57-29.363c8.0508 0.47266 17.051 0.94531 25.574 0.94531 47.832 0 52.094-4.7344 52.094-18.941-0.47266-30.309-25.102-56.828-52.566-56.828-16.102 0-31.73 8.9961-41.676 23.68 9.4688 16.098 15.152 33.621 16.574 51.145z"/>
<path d="m238.19 482.56c-35.992 0-80.508 0-80.508-47.359 0-46.41 36.938-85.246 80.508-85.246 28.887 0 56.828 17.996 71.039 46.41l3.7891 7.5781-4.7344 7.1055c-7.5781 11.367-17.051 30.309-16.574 53.516v14.207l-11.844 1.418c-9.9453 1.4219-22.258 2.3711-41.676 2.3711zm0-104.19c-27.941 0-52.094 26.52-52.094 56.828 0 14.207 4.2617 18.941 52.094 18.941 8.0508 0 17.051 0 25.574-0.94531 1.4219-17.523 7.1055-35.047 16.102-51.148-9.9453-14.68-25.57-23.676-41.676-23.676z"/>
<path d="m376 527.55c-53.043 0-113.19 0-113.19-63.461 0.003906-65.352 51.625-120.29 113.19-120.29 61.566 0 113.19 54.934 113.19 120.29 0 63.461-60.145 63.461-113.19 63.461zm0-155.34c-44.988 0-84.77 43.098-84.77 91.875 0 28.887 15.156 35.047 84.77 35.047 69.617 0 84.77-6.1562 84.77-35.047 0.003907-48.777-39.777-91.875-84.77-91.875z"/>
</g>
</svg>
This diff is collapsed.
...@@ -2117,6 +2117,10 @@ ...@@ -2117,6 +2117,10 @@
<label>Panjang Jalan Perbaikan :</label> <label>Panjang Jalan Perbaikan :</label>
<input type="text" id="panjangjalanperbaikan" class="form-control" value=""> <input type="text" id="panjangjalanperbaikan" class="form-control" value="">
</div> </div>
<div class="form-group">
<label>Sumber Dana :</label>
<input type="text" id="sumber_dana" class="form-control" value="">
</div>
<div class="form-group"> <div class="form-group">
<label>Lebar Jalan Perbaikan :</label> <label>Lebar Jalan Perbaikan :</label>
<input type="text" id="lebarjalanperbaikan" class="form-control" value=""> <input type="text" id="lebarjalanperbaikan" class="form-control" value="">
...@@ -2973,9 +2977,10 @@ ...@@ -2973,9 +2977,10 @@
var pj_lapangan = $("#pjlapangan").val(); var pj_lapangan = $("#pjlapangan").val();
var kontraktor = $("#kontraktor").val(); var kontraktor = $("#kontraktor").val();
var pjg_perbaikan = $("#panjangjalanperbaikan").val(); var pjg_perbaikan = $("#panjangjalanperbaikan").val();
var sumber_dana = $("#sumber_dana").val();
var lbr_perbaikan = $("#lebarjalanperbaikan").val(); var lbr_perbaikan = $("#lebarjalanperbaikan").val();
var jenis_perbaikan = $("#jenisperbaikan").val(); var jenis_perbaikan = $("#jenisperbaikan").val();
var luas = $("#luas").val(); // var luas = $("#luas").val();
var kelurahan = $("#kelurahan").val(); var kelurahan = $("#kelurahan").val();
var kecamatan = $("#kecamatan").val(); var kecamatan = $("#kecamatan").val();
...@@ -3005,18 +3010,21 @@ ...@@ -3005,18 +3010,21 @@
'kontraktor': kontraktor 'kontraktor': kontraktor
}, { }, {
'pjg_perbaikan': pjg_perbaikan 'pjg_perbaikan': pjg_perbaikan
}, {
'sumber_dana': sumber_dana
}, { }, {
'lbr_perbaikan': lbr_perbaikan 'lbr_perbaikan': lbr_perbaikan
}, { }, {
'jenis_perbaikan': jenis_perbaikan 'jenis_perbaikan': jenis_perbaikan
}, { // }, {
'luas': luas // 'luas': luas
}, { }, {
'kelurahan': kelurahan 'kelurahan': kelurahan
}, { }, {
'kecamatan': kecamatan 'kecamatan': kecamatan
}] }]
console.log(data_umum)
data = new FormData() data = new FormData()
data.append("proposal", $("input[id^='proposal']")[0].files[0]); data.append("proposal", $("input[id^='proposal']")[0].files[0]);
data.append("bukti_selesai", $("input[id^='buktiselesai']")[0].files[0]); data.append("bukti_selesai", $("input[id^='buktiselesai']")[0].files[0]);
......
...@@ -646,7 +646,7 @@ ...@@ -646,7 +646,7 @@
</div> </div>
</a> </a>
</div> </div>
<!-- <div class="col-md-4 text-center"> <div class="col-md-4 text-center">
<a href="#" class="btn btn_create_lahan"> <a href="#" class="btn btn_create_lahan">
<div> <div>
<img src="{% static 'img/icon-1/SquareHalflahan.svg' %}" alt="" style="width: 35px; <img src="{% static 'img/icon-1/SquareHalflahan.svg' %}" alt="" style="width: 35px;
...@@ -667,7 +667,7 @@ ...@@ -667,7 +667,7 @@
<span>KDB & KLB</span> <span>KDB & KLB</span>
</div> </div>
</a> </a>
</div> --> </div>
</div> </div>
</fieldset> </fieldset>
...@@ -805,6 +805,27 @@ ...@@ -805,6 +805,27 @@
</a> </a>
</div> </div>
<div style="margin-bottom: 10px;">
<a href="#grouproleuser" data-toggle="tab" class="tab-user btn btn-default" style="
width: 90%;
background: #FFFFFF;
box-sizing: border-box;
border-radius: 5px;" onclick="btnuserclick(event)">
<div class="row">
<div class="col-sm-2">
<img src="{% static 'img/icon-1/groupuser.svg' %}" alt="" style="width: 29px;height: 29px;">
</div>
<div class="col-sm-8 text-left" style="margin-top: 4px;">
Groups & Role User
</div>
<div class="col-sm-2">
<i class="caret" style="transform: rotate(-90deg);margin-top: 4px;"></i>
</div>
</div>
</a>
</div>
{% endif %} {% endif %}
<div style="margin-bottom: 10px;"> <div style="margin-bottom: 10px;">
<a href="#monitoringdatauser" data-toggle="tab" class="tab-user btn btn-default" style=" <a href="#monitoringdatauser" data-toggle="tab" class="tab-user btn btn-default" style="
...@@ -1042,7 +1063,7 @@ ...@@ -1042,7 +1063,7 @@
</a> </a>
</div> </div>
<div style="position: absolute;left: 250px;font-size: 10pt;background: #2196F3;border-radius: 10px;"> <div style="position: absolute;left: 292px;font-size: 10pt;background: #2196F3;border-radius: 10px;">
<a class="btn side-bar-but" id="add_user" style="z-index:9;color:white;"> <a class="btn side-bar-but" id="add_user" style="z-index:9;color:white;">
<div> <div>
<span>Tambah User</span> <span>Tambah User</span>
...@@ -1066,6 +1087,38 @@ ...@@ -1066,6 +1087,38 @@
</table> </table>
</div> </div>
<div class="tab-pane" id="grouproleuser">
<table class="table table-responsive datatable-show-all table-sm list_group" id="list_group" style="font-size : 8pt;padding:0px;border-top:0.5pt solid #EFEFEF;border-bottom:0.5pt solid #EFEFEF;margin-bottom: 10px;">
<div style="position: absolute;right: 30px;font-size: 10pt;">
<a class="btn side-bar-but" id="download_perbaikan" onclick="download_user_list('xlsx')" style="z-index:9;">
<div>
<i class="icon-download4"></i><span>&nbsp;&nbsp;&nbsp;Download</span>
</div>
</a>
</div>
<div style="position: absolute;left: 292px;font-size: 10pt;background: #2196F3;border-radius: 10px;">
<a class="btn side-bar-but" id="add_group" style="z-index:9;color:white;">
<div>
<span>Tambah Group</span>
</div>
</a>
</div>
<thead style="font-size: 12px;line-height: 14px;font-family: 'gilroysemibold';text-transform: capitalize;">
<tr>
<th>No.</th>
<th>Groups User</th>
<th class="text-center" style='padding:0px;'>Action</th>
</tr>
</thead>
<tbody id="tbody_group_list">
</tbody>
</table>
</div>
{% endif %} {% endif %}
<div class="tab-pane" id="monitoringdatauser"> <div class="tab-pane" id="monitoringdatauser">
...@@ -1746,6 +1799,63 @@ ...@@ -1746,6 +1799,63 @@
</div> </div>
</div> </div>
<div id="modal_edit_group" class="modal fade">
<div class="modal-dialog md" style="margin-top: 100px;">
<div class="modal-content" style="border-radius: 10px;">
<div class="modal-header bg-info" style="background-color: #1a222f !important;border-top-right-radius: 10px;border-top-left-radius: 10px;">
<button type="button" class="close" data-dismiss="modal" onclick="destroyfade()">&times;</button>
<h6 class="modal-title modstit">Modal Tambah Group</h6>
</div>
<div class="modal-body" style="max-height: 450px;overflow-y: auto;">
<input type="hidden" id="idgroup">
<div class="row">
<div class="form-group">
<label class="col-lg-3 control-label lbl-top">Group</label>
<div class="col-lg-9">
<input id="ingroup" type="text" class="form-control" value="" required>
</div>
</div>
</div>
<div class="row" group_use>
<div class="form-group" style="margin-top: 10px !important;">
<label class="col-lg-3 control-label lbl-top">Parent</label>
<div class="col-lg-9">
<select style="border-bottom: 1px solid rgb(83, 83, 83) !important;" id="select_parent" data-placeholder="select parent.." class="select-size-xs">
<option value=""></option>
</select>
</div>
</div>
</div>
<div class="row" style="margin-top: 20px;">
<div class="form-group">
<label class="col-lg-3 control-label">Aktif</label>
<div class="col-lg-9">
<label class="radio-inline">
<input type="radio" class="styled" value="true" name="isactive" checked="checked">
Ya
</label>
<label class="radio-inline">
<input type="radio" class="styled" value="false" name="isactive">
Tidak
</label>
</div>
</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="savegroup">Save changes</button>
</div>
</div>
</div>
</div>
<div id="modal_detail_point_pengaturan" class="modal fade mymodal"> <div id="modal_detail_point_pengaturan" class="modal fade mymodal">
<div class="modal-dialog modal-md" style="top: 10%;"> <div class="modal-dialog modal-md" style="top: 10%;">
<div class="modal-content" style="border-radius:10px;"> <div class="modal-content" style="border-radius:10px;">
......
...@@ -1160,6 +1160,9 @@ background: none;border-color: transparent;"> ...@@ -1160,6 +1160,9 @@ background: none;border-color: transparent;">
width: 50px;"> width: 50px;">
</a>`); </a>`);
$('.isi_detail_cek_jalan').show()
$('.map_detail_p_jalan').show()
map_detail_perbaikan.setView([data[0]['geometry']['coordinates'][0][0][1], data[0]['geometry']['coordinates'][0][0][0]], 18) map_detail_perbaikan.setView([data[0]['geometry']['coordinates'][0][0][1], data[0]['geometry']['coordinates'][0][0][0]], 18)
var myLines = [data[0]['geometry']]; var myLines = [data[0]['geometry']];
......
...@@ -451,6 +451,10 @@ ...@@ -451,6 +451,10 @@
<label>Panjang Jalan Perbaikan :</label> <label>Panjang Jalan Perbaikan :</label>
<input type="text" id="panjangjalanperbaikan" class="form-control" value=""> <input type="text" id="panjangjalanperbaikan" class="form-control" value="">
</div> </div>
<div class="form-group">
<label>Sumber Dana :</label>
<input type="text" id="sumber_dana" class="form-control" value="">
</div>
<div class="form-group"> <div class="form-group">
<label>Lebar Jalan Perbaikan :</label> <label>Lebar Jalan Perbaikan :</label>
<input type="text" id="lebarjalanperbaikan" class="form-control" value=""> <input type="text" id="lebarjalanperbaikan" class="form-control" value="">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment