Commit 651b6127 authored by Manggar Mahardhika's avatar Manggar Mahardhika

push

parent 4af4bf0f
...@@ -7,6 +7,8 @@ from django.db import connection as conn ...@@ -7,6 +7,8 @@ from django.db import connection as conn
# Create your views here. # Create your views here.
from rest_framework.renderers import JSONRenderer, TemplateHTMLRenderer from rest_framework.renderers import JSONRenderer, TemplateHTMLRenderer
import random
@api_view(('GET',)) @api_view(('GET',))
@renderer_classes((TemplateHTMLRenderer, JSONRenderer)) @renderer_classes((TemplateHTMLRenderer, JSONRenderer))
def search_auto(request): def search_auto(request):
...@@ -637,14 +639,17 @@ def editrumahsakit(request): ...@@ -637,14 +639,17 @@ def editrumahsakit(request):
luastanah = request.POST.get('luastanah') luastanah = request.POST.get('luastanah')
tinggibangunan = request.POST.get('tinggibangunan') tinggibangunan = request.POST.get('tinggibangunan')
# gambar = request.POST.get('gambar') # gambar = request.POST.get('gambar')
alamat = request.POST.get('alamat')
if alamat is None: if alamat is None:
alamat = "alamat" alamat = 'alamat'
elif alamat == '':
alamat = 'alamat'
else: else:
alamat = request.POST.get('alamat') alamat = request.POST.get('alamat')
perangkat = request.POST.get('perangkat') perangkat = request.POST.get('perangkat')
if perangkat is None: if perangkat is None:
perangkat = "bpk" perangkat = 'bpk'
elif perangkat == '':
perangkat = 'bpk'
else: else:
perangkat = request.POST.get('perangkat') perangkat = request.POST.get('perangkat')
...@@ -653,8 +658,24 @@ def editrumahsakit(request): ...@@ -653,8 +658,24 @@ def editrumahsakit(request):
co_edit = cood_edit['geometry']['coordinates'] co_edit = cood_edit['geometry']['coordinates']
file = request.FILES.get('file')
fss = FileSystemStorage(location='static/img/image/')
try:
format = (file.name).split(".")
num = random.randrange(1, 10000000000000)
namafile = f"{namars}_{num}.{format[-1:][0]}"
filename = fss.save(namafile, file)
# print(file.name)
url = fss.url(filename)
except:
num = random.randrange(1, 10000000000000)
namafile = "rs.svg"
filename = fss.save(namafile, file)
# print(file.name)
url = fss.url(filename)
with conn.cursor() as editrs: with conn.cursor() as editrs:
editrs.execute("""update geo_rumah_sakit set geom = st_geomfromgeojson('{"type":"Point", "coordinates":%s, "crs":{"type":"name","properties":{"name":"EPSG:4326"}}}'), namobj = '%s', alamat = '%s', remark = '%s', luas_bangunan = '%s', luas_tanah = '%s', tinggi_bangunan = '%s', perangkat = '%s' where id = %s"""%(co_edit, namars, alamat, remark, luasbangunan, luastanah, tinggibangunan, perangkat, idrs)) editrs.execute("""update geo_rumah_sakit set geom = st_geomfromgeojson('{"type":"Point", "coordinates":%s, "crs":{"type":"name","properties":{"name":"EPSG:4326"}}}'), namobj = '%s', alamat = '%s', remark = '%s', luas_bangunan = '%s', luas_tanah = '%s', tinggi_bangunan = '%s', perangkat = '%s', gambar = '%s' where id = %s"""%(co_edit, namars, alamat, remark, luasbangunan, luastanah, tinggibangunan, perangkat, filename, idrs))
conn.commit() conn.commit()
with conn.cursor() as hasledit: with conn.cursor() as hasledit:
...@@ -672,10 +693,43 @@ def editcagarbudaya(request): ...@@ -672,10 +693,43 @@ def editcagarbudaya(request):
remark = request.POST.get('remark') remark = request.POST.get('remark')
gambar = request.POST.get('gambar') gambar = request.POST.get('gambar')
alamat = request.POST.get('alamat') alamat = request.POST.get('alamat')
if alamat is None:
alamat = 'alamat'
elif alamat == '':
alamat = 'alamat'
else:
alamat = request.POST.get('alamat')
perangkat = request.POST.get('perangkat') perangkat = request.POST.get('perangkat')
if perangkat is None:
perangkat = 'bpk'
elif perangkat == '':
perangkat = 'bpk'
else:
perangkat = request.POST.get('perangkat')
point = request.POST.get("point")
cood_edit = json.loads(point)
co_edit = cood_edit['geometry']['coordinates']
file = request.FILES.get('file')
fss = FileSystemStorage(location='static/img/image/')
try:
format = (file.name).split(".")
num = random.randrange(1, 10000000000000)
namafile = f"{namobj}_{num}.{format[-1:][0]}"
filename = fss.save(namafile, file)
# print(file.name)
url = fss.url(filename)
except:
num = random.randrange(1, 10000000000000)
namafile = "loc.svg"
filename = fss.save(namafile, file)
# print(file.name)
url = fss.url(filename)
with conn.cursor() as editcagar: with conn.cursor() as editcagar:
editcagar.execute("""update geo_cagar_budaya set namobj = '%s', alamat = '%s', remark = '%s', luas = '%s', gambar = '%s', perangkat = '%s' where id = %s"""% (namobj, alamat, remark, luas, gambar, perangkat, idcagar)) editcagar.execute("""update geo_cagar_budaya set namobj = '%s', alamat = '%s', remark = '%s', luas = '%s', perangkat = '%s', gambar = '%s' where id = %s"""% (namobj, alamat, remark, luas, perangkat, filename, idcagar))
conn.commit() conn.commit()
with conn.cursor() as hasiledit: with conn.cursor() as hasiledit:
...@@ -696,12 +750,16 @@ def editkantoradmin(request): ...@@ -696,12 +750,16 @@ def editkantoradmin(request):
# gambar = request.POST.get('gambar') # gambar = request.POST.get('gambar')
alamat = request.POST.get('alamat') alamat = request.POST.get('alamat')
if alamat is None: if alamat is None:
alamat = "alamat" alamat = 'alamat'
elif alamat == '':
alamat = 'alamat'
else: else:
alamat = request.POST.get('alamat') alamat = request.POST.get('alamat')
perangkat = request.POST.get('perangkat') perangkat = request.POST.get('perangkat')
if perangkat is None: if perangkat is None:
perangkat = "Bpk" perangkat = 'bpk'
elif perangkat == '':
perangkat = 'bpk'
else: else:
perangkat = request.POST.get('perangkat') perangkat = request.POST.get('perangkat')
...@@ -710,8 +768,20 @@ def editkantoradmin(request): ...@@ -710,8 +768,20 @@ def editkantoradmin(request):
co_edit = cood_edit['geometry']['coordinates'] co_edit = cood_edit['geometry']['coordinates']
file = request.FILES.get('file')
fss = FileSystemStorage(location='static/img/image/')
try:
format = (file.name).split(".")
num = random.randrange(1, 10000000000000)
namafile = f"{namobj}_{num}.{format[-1:][0]}"
filename = fss.save(namafile, file)
# print(file.name)
url = fss.url(filename)
except:
namafile = "lurah.svg"
with conn.cursor() as editka: with conn.cursor() as editka:
editka.execute("""update geo_kantor_administrasi set geom = st_geomfromgeojson('{"type":"Point", "coordinates":%s, "crs":{"type":"name","properties":{"name":"EPSG:4326"}}}'), namobj = '%s', remark = '%s', luas_bangunan = %s, luas_tanah = %s, tinggi_bangunan = %s, perangkat = '%s', alamat = '%s' where id = %s"""%(co_edit, namobj, remark, luas_bangunan, luat_tanah, tinggi_bangunan, perangkat, alamat, idkantor)) editka.execute("""update geo_kantor_administrasi set geom = st_geomfromgeojson('{"type":"Point", "coordinates":%s, "crs":{"type":"name","properties":{"name":"EPSG:4326"}}}'), namobj = '%s', remark = '%s', luas_bangunan = %s, luas_tanah = %s, tinggi_bangunan = %s, perangkat = '%s', alamat = '%s', gambar = '%s' where id = %s"""%(co_edit, namobj, remark, luas_bangunan, luat_tanah, tinggi_bangunan, perangkat, alamat, filename, idkantor))
conn.commit() conn.commit()
with conn.cursor() as hasiledit: with conn.cursor() as hasiledit:
...@@ -732,12 +802,16 @@ def editlayanankesehatan(request): ...@@ -732,12 +802,16 @@ def editlayanankesehatan(request):
# gambar = request.POST.get('gambar') # gambar = request.POST.get('gambar')
alamat = request.POST.get('alamat') alamat = request.POST.get('alamat')
if alamat is None: if alamat is None:
alamat = "alamat" alamat = 'alamat'
elif alamat == '':
alamat = 'alamat'
else: else:
alamat = request.POST.get('alamat') alamat = request.POST.get('alamat')
perangkat = request.POST.get('perangkat') perangkat = request.POST.get('perangkat')
if perangkat is None: if perangkat is None:
perangkat = "bpk" perangkat = 'bpk'
elif perangkat == '':
perangkat = 'bpk'
else: else:
perangkat = request.POST.get('perangkat') perangkat = request.POST.get('perangkat')
...@@ -746,8 +820,20 @@ def editlayanankesehatan(request): ...@@ -746,8 +820,20 @@ def editlayanankesehatan(request):
co_edit = cood_edit['geometry']['coordinates'] co_edit = cood_edit['geometry']['coordinates']
file = request.FILES.get('file')
fss = FileSystemStorage(location='static/img/image/')
try:
format = (file.name).split(".")
num = random.randrange(1, 10000000000000)
namafile = f"{namobj}_{num}.{format[-1:][0]}"
filename = fss.save(namafile, file)
# print(file.name)
url = fss.url(filename)
except:
namafile = "rs.svg"
with conn.cursor() as editka: with conn.cursor() as editka:
editka.execute("""update geo_layanan_kesehatan set geom = st_geomfromgeojson('{"type":"Point", "coordinates":%s, "crs":{"type":"name","properties":{"name":"EPSG:4326"}}}'), namobj = '%s', remark = '%s', luas_bangunan = %s, luas_tanah = %s, tinggi_bangunan = %s, perangkat = '%s', alamat = '%s' where id = %s"""%(co_edit, namobj, remark, luas_bangunan, luat_tanah, tinggi_bangunan, perangkat, alamat, idlakes)) editka.execute("""update geo_layanan_kesehatan set geom = st_geomfromgeojson('{"type":"Point", "coordinates":%s, "crs":{"type":"name","properties":{"name":"EPSG:4326"}}}'), namobj = '%s', remark = '%s', luas_bangunan = %s, luas_tanah = %s, tinggi_bangunan = %s, perangkat = '%s', alamat = '%s', gambar = '%s' where id = %s"""%(co_edit, namobj, remark, luas_bangunan, luat_tanah, tinggi_bangunan, perangkat, alamat, filename, idlakes))
conn.commit() conn.commit()
with conn.cursor() as hasiledit: with conn.cursor() as hasiledit:
...@@ -768,12 +854,16 @@ def editpuskesmas(request): ...@@ -768,12 +854,16 @@ def editpuskesmas(request):
# gambar = request.POST.get('gambar') # gambar = request.POST.get('gambar')
alamat = request.POST.get('alamat') alamat = request.POST.get('alamat')
if alamat is None: if alamat is None:
alamat = "alamat" alamat = 'alamat'
elif alamat == '':
alamat = 'alamat'
else: else:
alamat = request.POST.get('alamat') alamat = request.POST.get('alamat')
perangkat = request.POST.get('perangkat') perangkat = request.POST.get('perangkat')
if perangkat is None: if perangkat is None:
perangkat = "bpk" perangkat = 'bpk'
elif perangkat == '':
perangkat = 'bpk'
else: else:
perangkat = request.POST.get('perangkat') perangkat = request.POST.get('perangkat')
...@@ -782,8 +872,20 @@ def editpuskesmas(request): ...@@ -782,8 +872,20 @@ def editpuskesmas(request):
co_edit = cood_edit['geometry']['coordinates'] co_edit = cood_edit['geometry']['coordinates']
file = request.FILES.get('file')
fss = FileSystemStorage(location='static/img/image/')
try:
format = (file.name).split(".")
num = random.randrange(1, 10000000000000)
namafile = f"{namobj}_{num}.{format[-1:][0]}"
filename = fss.save(namafile, file)
# print(file.name)
url = fss.url(filename)
except:
namafile = "rs.svg"
with conn.cursor() as editrs: with conn.cursor() as editrs:
editrs.execute("""update geo_puskesmas set geom = st_geomfromgeojson('{"type":"Point", "coordinates":%s, "crs":{"type":"name","properties":{"name":"EPSG:4326"}}}'), namobj = '%s', remark = '%s', luas_bangunan = '%s', luas_tanah = '%s', tinggi_bangunan = '%s', perangkat = '%s', alamat = '%s' where id = %s"""%(co_edit, namobj, remark, luas_bangunan, luat_tanah, tinggi_bangunan, perangkat, alamat, idpus)) editrs.execute("""update geo_puskesmas set geom = st_geomfromgeojson('{"type":"Point", "coordinates":%s, "crs":{"type":"name","properties":{"name":"EPSG:4326"}}}'), namobj = '%s', remark = '%s', luas_bangunan = '%s', luas_tanah = '%s', tinggi_bangunan = '%s', perangkat = '%s', alamat = '%s', gambar = '%s' where id = %s"""%(co_edit, namobj, remark, luas_bangunan, luat_tanah, tinggi_bangunan, perangkat, alamat, filename, idpus))
conn.commit() conn.commit()
with conn.cursor() as hasiledit: with conn.cursor() as hasiledit:
...@@ -807,12 +909,16 @@ def editibadah(request): ...@@ -807,12 +909,16 @@ def editibadah(request):
perangkat = request.POST.get('perangkat') perangkat = request.POST.get('perangkat')
alamat = request.POST.get('alamat') alamat = request.POST.get('alamat')
if alamat is None: if alamat is None:
alamat = "alamat" alamat = 'alamat'
elif alamat == '':
alamat = 'alamat'
else: else:
alamat = request.POST.get('alamat') alamat = request.POST.get('alamat')
perangkat = request.POST.get('perangkat') perangkat = request.POST.get('perangkat')
if perangkat is None: if perangkat is None:
perangkat = "bpk" perangkat = 'bpk'
elif perangkat == '':
perangkat = 'bpk'
else: else:
perangkat = request.POST.get('perangkat') perangkat = request.POST.get('perangkat')
...@@ -821,8 +927,24 @@ def editibadah(request): ...@@ -821,8 +927,24 @@ def editibadah(request):
co_edit = cood_edit['geometry']['coordinates'] co_edit = cood_edit['geometry']['coordinates']
file = request.FILES.get('file')
fss = FileSystemStorage(location='static/img/image/')
try:
format = (file.name).split(".")
num = random.randrange(1, 10000000000000)
namafile = f"{namobj}_{num}.{format[-1:][0]}"
filename = fss.save(namafile, file)
# print(file.name)
url = fss.url(filename)
except:
num = random.randrange(1, 10000000000000)
namafile = "masjid.svg"
filename = fss.save(namafile, file)
# print(file.name)
url = fss.url(filename)
with conn.cursor() as editrs: with conn.cursor() as editrs:
editrs.execute("""update geo_sarana_ibadah set geom = st_geomfromgeojson('{"type":"Point", "coordinates":%s, "crs":{"type":"name","properties":{"name":"EPSG:4326"}}}'), namobj = '%s', remark = '%s', luas_bangunan = '%s', luas_tanah = '%s', tinggi_bangunan = '%s', perangkat = '%s', alamat = '%s' where id = %s"""%(co_edit, namobj, remark, luas_bangunan, luat_tanah, tinggi_bangunan, perangkat, alamat, idsarib)) editrs.execute("""update geo_sarana_ibadah set geom = st_geomfromgeojson('{"type":"Point", "coordinates":%s, "crs":{"type":"name","properties":{"name":"EPSG:4326"}}}'), namobj = '%s', remark = '%s', luas_bangunan = '%s', luas_tanah = '%s', tinggi_bangunan = '%s', perangkat = '%s', alamat = '%s', gambar = '%s' where id = %s"""%(co_edit, namobj, remark, luas_bangunan, luat_tanah, tinggi_bangunan, perangkat, alamat, filename, idsarib))
conn.commit() conn.commit()
with conn.cursor() as hasiledit: with conn.cursor() as hasiledit:
...@@ -845,12 +967,16 @@ def editsekolah(request): ...@@ -845,12 +967,16 @@ def editsekolah(request):
# gambar = request.POST.get('gambar') # gambar = request.POST.get('gambar')
alamat = request.POST.get('alamat') alamat = request.POST.get('alamat')
if alamat is None: if alamat is None:
alamat = "alamat" alamat = 'alamat'
elif alamat == '':
alamat = 'alamat'
else: else:
alamat = request.POST.get('alamat') alamat = request.POST.get('alamat')
perangkat = request.POST.get('perangkat') perangkat = request.POST.get('perangkat')
if perangkat is None: if perangkat is None:
perangkat = "bpk" perangkat = 'bpk'
elif perangkat == '':
perangkat = 'bpk'
else: else:
perangkat = request.POST.get('perangkat') perangkat = request.POST.get('perangkat')
...@@ -859,8 +985,24 @@ def editsekolah(request): ...@@ -859,8 +985,24 @@ def editsekolah(request):
co_edit = cood_edit['geometry']['coordinates'] co_edit = cood_edit['geometry']['coordinates']
file = request.FILES.get('file')
fss = FileSystemStorage(location='static/img/image/')
try:
format = (file.name).split(".")
num = random.randrange(1, 10000000000000)
namafile = f"{namobj}_{num}.{format[-1:][0]}"
filename = fss.save(namafile, file)
# print(file.name)
url = fss.url(filename)
except:
num = random.randrange(1, 10000000000000)
namafile = "sekolah.svg"
filename = fss.save(namafile, file)
# print(file.name)
url = fss.url(filename)
with conn.cursor() as editrs: with conn.cursor() as editrs:
editrs.execute("""update geo_sarana_pendidikan set geom = st_geomfromgeojson('{"type":"Point", "coordinates":%s, "crs":{"type":"name","properties":{"name":"EPSG:4326"}}}'), namobj = '%s', remark = '%s', luas_bangunan = '%s', luas_tanah = '%s', tinggi_bangunan = '%s', perangkat = '%s', alamat = '%s' where id = %s"""%(co_edit, namobj, remark, luas_bangunan, luat_tanah, tinggi_bangunan, perangkat, alamat, idsekolah)) editrs.execute("""update geo_sarana_pendidikan set geom = st_geomfromgeojson('{"type":"Point", "coordinates":%s, "crs":{"type":"name","properties":{"name":"EPSG:4326"}}}'), namobj = '%s', remark = '%s', luas_bangunan = '%s', luas_tanah = '%s', tinggi_bangunan = '%s', perangkat = '%s', alamat = '%s', gambar = '%s' where id = %s"""%(co_edit, namobj, remark, luas_bangunan, luat_tanah, tinggi_bangunan, perangkat, alamat, filename, idsekolah))
conn.commit() conn.commit()
with conn.cursor() as hasiledit: with conn.cursor() as hasiledit:
...@@ -884,11 +1026,15 @@ def editspbu(request): ...@@ -884,11 +1026,15 @@ def editspbu(request):
alamat = request.POST.get('alamat') alamat = request.POST.get('alamat')
if alamat is None: if alamat is None:
alamat = 'alamat' alamat = 'alamat'
elif alamat == '':
alamat = 'alamat'
else: else:
alamat = request.POST.get('alamat') alamat = request.POST.get('alamat')
perangkat = request.POST.get('perangkat') perangkat = request.POST.get('perangkat')
if perangkat is None: if perangkat is None:
perangkat = 'bpk' perangkat = 'bpk'
elif perangkat == '':
perangkat = 'bpk'
else: else:
perangkat = request.POST.get('perangkat') perangkat = request.POST.get('perangkat')
...@@ -897,8 +1043,24 @@ def editspbu(request): ...@@ -897,8 +1043,24 @@ def editspbu(request):
co_edit = cood_edit['geometry']['coordinates'] co_edit = cood_edit['geometry']['coordinates']
file = request.FILES.get('file')
fss = FileSystemStorage(location='static/img/image/')
try:
format = (file.name).split(".")
num = random.randrange(1, 10000000000000)
namafile = f"{namobj}_{num}.{format[-1:][0]}"
filename = fss.save(namafile, file)
# print(file.name)
url = fss.url(filename)
except:
num = random.randrange(1, 10000000000000)
namafile = "masjid.svg"
filename = fss.save(namafile, file)
# print(file.name)
url = fss.url(filename)
with conn.cursor() as editrs: with conn.cursor() as editrs:
editrs.execute("""update geo_spbu set geom = st_geomfromgeojson('{"type":"Point", "coordinates":%s, "crs":{"type":"name","properties":{"name":"EPSG:4326"}}}'), namobj = '%s', remark = '%s', luas_bangunan = '%s', luas_tanah = '%s', tinggi_bangunan = '%s', perangkat = '%s', alamat = '%s' where id = %s"""%(co_edit, namobj, remark, luas_bangunan, luat_tanah, tinggi_bangunan, perangkat, alamat, idspbu)) editrs.execute("""update geo_spbu set geom = st_geomfromgeojson('{"type":"Point", "coordinates":%s, "crs":{"type":"name","properties":{"name":"EPSG:4326"}}}'), namobj = '%s', remark = '%s', luas_bangunan = '%s', luas_tanah = '%s', tinggi_bangunan = '%s', perangkat = '%s', alamat = '%s', gambar = '%s' where id = %s"""%(co_edit, namobj, remark, luas_bangunan, luat_tanah, tinggi_bangunan, perangkat, alamat, filename, idspbu))
conn.commit() conn.commit()
with conn.cursor() as hasiledit: with conn.cursor() as hasiledit:
...@@ -921,11 +1083,15 @@ def editstasiun(request): ...@@ -921,11 +1083,15 @@ def editstasiun(request):
alamat = request.POST.get('alamat') alamat = request.POST.get('alamat')
if alamat is None: if alamat is None:
alamat = 'alamat' alamat = 'alamat'
elif alamat == '':
alamat = 'alamat'
else: else:
alamat = request.POST.get('alamat') alamat = request.POST.get('alamat')
perangkat = request.POST.get('perangkat') perangkat = request.POST.get('perangkat')
if perangkat is None: if perangkat is None:
perangkat = 'bpk' perangkat = 'bpk'
elif perangkat == '':
perangkat = 'bpk'
else: else:
perangkat = request.POST.get('perangkat') perangkat = request.POST.get('perangkat')
...@@ -934,8 +1100,24 @@ def editstasiun(request): ...@@ -934,8 +1100,24 @@ def editstasiun(request):
co_edit = cood_edit['geometry']['coordinates'] co_edit = cood_edit['geometry']['coordinates']
file = request.FILES.get('file')
fss = FileSystemStorage(location='static/img/image/')
try:
format = (file.name).split(".")
num = random.randrange(1, 10000000000000)
namafile = f"{namobj}_{num}.{format[-1:][0]}"
filename = fss.save(namafile, file)
# print(file.name)
url = fss.url(filename)
except:
num = random.randrange(1, 10000000000000)
namafile = "kereta.svg"
filename = fss.save(namafile, file)
# print(file.name)
url = fss.url(filename)
with conn.cursor() as editrs: with conn.cursor() as editrs:
editrs.execute("""update geo_stasiun set geom = st_geomfromgeojson('{"type":"Point", "coordinates":%s, "crs":{"type":"name","properties":{"name":"EPSG:4326"}}}'), namobj = '%s', remark = '%s', luas_bangunan = '%s', luas_tanah = '%s', tinggi_bangunan = '%s', perangkat = '%s', alamat = '%s' where id = %s"""%(co_edit, namobj, remark, luas_bangunan, luat_tanah, tinggi_bangunan, perangkat, alamat, idstasiun)) editrs.execute("""update geo_stasiun set geom = st_geomfromgeojson('{"type":"Point", "coordinates":%s, "crs":{"type":"name","properties":{"name":"EPSG:4326"}}}'), namobj = '%s', remark = '%s', luas_bangunan = '%s', luas_tanah = '%s', tinggi_bangunan = '%s', perangkat = '%s', alamat = '%s', gambar = '%s' where id = %s"""%(co_edit, namobj, remark, luas_bangunan, luat_tanah, tinggi_bangunan, perangkat, alamat, filename, idstasiun))
conn.commit() conn.commit()
with conn.cursor() as hasiledit: with conn.cursor() as hasiledit:
...@@ -956,11 +1138,15 @@ def editterminal(request): ...@@ -956,11 +1138,15 @@ def editterminal(request):
alamat = request.POST.get('alamat') alamat = request.POST.get('alamat')
if alamat is None: if alamat is None:
alamat = 'alamat' alamat = 'alamat'
elif alamat == '':
alamat = 'alamat'
else: else:
alamat = request.POST.get('alamat') alamat = request.POST.get('alamat')
perangkat = request.POST.get('perangkat') perangkat = request.POST.get('perangkat')
if perangkat is None: if perangkat is None:
perangkat = 'bpk' perangkat = 'bpk'
elif perangkat == '':
perangkat = 'bpk'
else: else:
perangkat = request.POST.get('perangkat') perangkat = request.POST.get('perangkat')
...@@ -969,8 +1155,24 @@ def editterminal(request): ...@@ -969,8 +1155,24 @@ def editterminal(request):
co_edit = cood_edit['geometry']['coordinates'] co_edit = cood_edit['geometry']['coordinates']
file = request.FILES.get('file')
fss = FileSystemStorage(location='static/img/image/')
try:
format = (file.name).split(".")
num = random.randrange(1, 10000000000000)
namafile = f"{namobj}_{num}.{format[-1:][0]}"
filename = fss.save(namafile, file)
# print(file.name)
url = fss.url(filename)
except:
num = random.randrange(1, 10000000000000)
namafile = "terminal_batu_kuning.png"
filename = fss.save(namafile, file)
# print(file.name)
url = fss.url(filename)
with conn.cursor() as editrs: with conn.cursor() as editrs:
editrs.execute("""update geo_terminal_bus set namobj = '%s', remark = '%s', luas = '%s', perangkat = '%s', alamat = '%s' where id = %s"""%(namobj, remark, luas, perangkat, alamat, idterm)) editrs.execute("""update geo_terminal_bus set geom = st_geomfromgeojson('{"type":"Point", "coordinates":%s, "crs":{"type":"name","properties":{"name":"EPSG:4326"}}}'), namobj = '%s', remark = '%s', luas = '%s', perangkat = '%s', alamat = '%s', gambar = '%s' where id = %s"""%(co_edit, namobj, remark, luas, perangkat, alamat, filename, idterm))
conn.commit() conn.commit()
with conn.cursor() as hasiledit: with conn.cursor() as hasiledit:
...@@ -1006,8 +1208,25 @@ def editgardu(request): ...@@ -1006,8 +1208,25 @@ def editgardu(request):
co_edit = cood_edit['geometry']['coordinates'] co_edit = cood_edit['geometry']['coordinates']
file = request.FILES.get('file')
fss = FileSystemStorage(location='static/img/image/')
try:
format = (file.name).split(".")
num = random.randrange(1, 10000000000000)
namafile = f"{namobj}_{num}.{format[-1:][0]}"
filename = fss.save(namafile, file)
# print(file.name)
url = fss.url(filename)
except:
num = random.randrange(1, 10000000000000)
namafile = "terminal_batu_kuning.png"
filename = fss.save(namafile, file)
# print(file.name)
url = fss.url(filename)
with conn.cursor() as editrs: with conn.cursor() as editrs:
editrs.execute("""update geo_gardu_listrik set geom = st_geomfromgeojson('{"type":"Point", "coordinates":%s, "crs":{"type":"name","properties":{"name":"EPSG:4326"}}}'), namobj = '%s', remark = '%s', luas_bangunan = '%s', luas_tanah = '%s', tinggi_bangunan = '%s', perangkat = '%s', alamat = '%s' where id = %s"""%(co_edit, namobj, remark, luas_bangunan, luat_tanah, tinggi_bangunan, perangkat, alamat, idgardu)) editrs.execute("""update geo_gardu_listrik set geom = st_geomfromgeojson('{"type":"Point", "coordinates":%s, "crs":{"type":"name","properties":{"name":"EPSG:4326"}}}'), namobj = '%s', remark = '%s', luas_bangunan = '%s', luas_tanah = '%s', tinggi_bangunan = '%s', perangkat = '%s', alamat = '%s', gambar = '%s' where id = %s"""%(co_edit, namobj, remark, luas_bangunan, luat_tanah, tinggi_bangunan, perangkat, alamat, filename, idgardu))
conn.commit() conn.commit()
with conn.cursor() as hasiledit: with conn.cursor() as hasiledit:
...@@ -1030,7 +1249,6 @@ from PIL import Image ...@@ -1030,7 +1249,6 @@ from PIL import Image
@api_view(('POST',)) @api_view(('POST',))
def cobagam(request): def cobagam(request):
file = request.FILES.get('file') file = request.FILES.get('file')
fss = FileSystemStorage(location='static/image/kelurahan/') fss = FileSystemStorage(location='static/image/kelurahan/')
filename = fss.save(file.name, file) filename = fss.save(file.name, file)
url = fss.url(filename) url = fss.url(filename)
......
from decimal import Context # from decimal import Context
from typing import get_origin # from typing import get_origin
from django.db.models.expressions import F from django.db.models.expressions import F
from django.http import response from django.http import response
from django.views import View, generic from django.views import View, generic
......
...@@ -348,8 +348,12 @@ ...@@ -348,8 +348,12 @@
<div class="tab-pane" id="right-tab2-feas-upl"> <div class="tab-pane" id="right-tab2-feas-upl">
<div class="form-group"> <div class="form-group">
<div id="map-for-edit" style="width: 400px;height: 300px;position: relative;margin-left: 100px;"></div> <div id="map-for-edit" style="width: 400px;height: 300px;position: relative;margin-left: 100px;"></div>
<label style="margin-top: 10px; margin-left: 50px;" for="exampleFormControlFile1">Input Foto</label> <div class="form-group">
<input style="margin-top: 10px; margin-left: 50px;" type="file" class="form-control-file" id="uploadFile"> <label class="col-lg-2 control-label" style="margin-top:10px">Image</label>
<div class="col-lg-9" style="margin-top:10px">
<input type="file" id="file" name="images[]" multiple accept="image/jpg,image/png,image/jpeg,image/gif">
</div>
</div>
</div> </div>
</div> </div>
...@@ -371,7 +375,7 @@ ...@@ -371,7 +375,7 @@
<thead style="text-align: center;"> <thead style="text-align: center;">
<tr> <tr>
<th style="padding: 0 0 0 0px;"> <th style="padding: 0 0 0 0px;">
<img src="static/img/image/`+ feature.administrasi.f8 +`.`+ feature.administrasi.f11 +`" alt="Image" style="width: 100%;max-height: 237px;height:237"> <img src="static/img/image/`+ feature.administrasi.f8 +`" alt="Image" style="width: 100%;max-height: 237px;height:237">
</th> </th>
</tr> </tr>
</thead> </thead>
...@@ -511,37 +515,41 @@ ...@@ -511,37 +515,41 @@
var hasil = (JSON.stringify(poinin.toGeoJSON())) var hasil = (JSON.stringify(poinin.toGeoJSON()))
$("#coordinateZoneedit").val(hasil); $("#coordinateZoneedit").val(hasil);
}) })
} }
}) })
}); });
$(document).on("click", "#saveeditadm", function() { $(document).on("click", "#saveeditadm", function() {
var idka = $('#id').val(); var idka = $('#id').val();
var poi = $('#coordinateZoneedit').val(); var poi = $('#coordinateZoneedit').val();
console.log(poi) var data = new FormData();
data.append("file", $("input[id^='file']")[0].files[0]);
data.append("csrfmiddlewaretoken", "{{ csrf_token }}");
data.append('id',idka)
data.append('namobj', $('#namobj').val())
data.append('remark', $('#remark').val())
data.append('luasbangunan', $('#luas_bangunan').val())
data.append('luastanah', $('#luas_tanah').val())
data.append('tinggibangunan', $('#tinggi_bangunan').val())
data.append('alamat', $('#alamat').val())
data.append('perangkat', $('#perangkat').val())
data.append('point', poi)
$.ajax({ $.ajax({
url: "{% url 'api:kantor' %}", url: "{% url 'api:kantor' %}",
data: { data: data,
'id': idka,
'namobj': $('#namobj').val(),
'remark': $('#remark').val(),
'luasbangunan': $('#luas_bangunan').val(),
'luastanah': $('#luas_tanah').val(),
'tinggibangunan': $('#tinggi_bangunan').val(),
'alamat': $('#alamat').val(),
'perangkat': $('#perangkat').val(),
'point': poi
},
dataType: 'json', dataType: 'json',
type: 'POST', type: 'POST',
processData: false,
contentType: false,
success: function(data) { success: function(data) {
alert('sukses') alert('sukses')
location.reload() location.reload()
} }
}) })
}); });
var layanan_kesehatan = "{{ layanan_kesehatan }}".replace(/&#x27;/g, '"'); var layanan_kesehatan = "{{ layanan_kesehatan }}".replace(/&#x27;/g, '"');
...@@ -714,8 +722,12 @@ ...@@ -714,8 +722,12 @@
<div class="tab-pane" id="right-tab2-feas-upl"> <div class="tab-pane" id="right-tab2-feas-upl">
<div class="form-group"> <div class="form-group">
<div id="map-for-edit" style="width: 400px;height: 300px;position: relative;margin-left: 100px;"></div> <div id="map-for-edit" style="width: 400px;height: 300px;position: relative;margin-left: 100px;"></div>
<label style="margin-top: 10px; margin-left: 50px;" for="exampleFormControlFile1">Input Foto</label> <div class="form-group">
<input style="margin-top: 10px; margin-left: 50px;" type="file" class="form-control-file" id="uploadFile"> <label class="col-lg-2 control-label" style="margin-top:10px">Image</label>
<div class="col-lg-9" style="margin-top:10px">
<input type="file" id="file" name="images[]" multiple accept="image/jpg,image/png,image/jpeg,image/gif">
</div>
</div>
</div> </div>
</div> </div>
...@@ -737,7 +749,7 @@ ...@@ -737,7 +749,7 @@
<thead style="text-align: center;"> <thead style="text-align: center;">
<tr> <tr>
<th style="padding: 0 0 0 0px;"> <th style="padding: 0 0 0 0px;">
<img src="static/img/image/`+ feature.administrasi.f8 +`.`+ feature.administrasi.f11 +`" alt="Image" style="width: 100%;max-height: 237px;height:237"> <img src="static/img/image/`+ feature.administrasi.f8 +`" alt="Image" style="width: 100%;max-height: 237px;height:237">
</th> </th>
</tr> </tr>
</thead> </thead>
...@@ -885,23 +897,26 @@ ...@@ -885,23 +897,26 @@
$(document).on("click", "#saveeditlk", function() { $(document).on("click", "#saveeditlk", function() {
var idka = $('#idlk').val(); var idka = $('#idlk').val();
var poi = $('#coordinateZoneeditlk').val(); var poi = $('#coordinateZoneeditlk').val();
console.log(poi) var data = new FormData();
data.append("file", $("input[id^='file']")[0].files[0]);
data.append("csrfmiddlewaretoken", "{{ csrf_token }}");
data.append('id',idka)
data.append('namobj', $('#namobj').val())
data.append('remark', $('#remark').val())
data.append('luasbangunan', $('#luas_bangunan').val())
data.append('luastanah', $('#luas_tanah').val())
data.append('tinggibangunan', $('#tinggi_bangunan').val())
data.append('alamat', $('#alamat').val())
data.append('perangkat', $('#perangkat').val())
data.append('point', poi)
$.ajax({ $.ajax({
url: "{% url 'api:layanankesehatan' %}", url: "{% url 'api:layanankesehatan' %}",
data: { data: data,
'id': idka,
'namobj': $('#namobj').val(),
'remark': $('#remark').val(),
'luasbangunan': $('#luas_bangunan').val(),
'luastanah': $('#luas_tanah').val(),
'tinggibangunan': $('#tinggi_bangunan').val(),
'alamat': $('#alamat').val(),
'perangkat': $('#perangkat').val(),
'point': poi
},
dataType: 'json', dataType: 'json',
type: 'POST', type: 'POST',
processData: false,
contentType: false,
success: function(data) { success: function(data) {
alert('sukses') alert('sukses')
location.reload() location.reload()
...@@ -1080,8 +1095,12 @@ ...@@ -1080,8 +1095,12 @@
<div class="tab-pane" id="right-tab2-feas-upl"> <div class="tab-pane" id="right-tab2-feas-upl">
<div class="form-group"> <div class="form-group">
<div id="map-for-edit" style="width: 400px;height: 300px;position: relative;margin-left: 100px;"></div> <div id="map-for-edit" style="width: 400px;height: 300px;position: relative;margin-left: 100px;"></div>
<label style="margin-top: 10px; margin-left: 50px;" for="exampleFormControlFile1">Input Foto</label> <div class="form-group">
<input style="margin-top: 10px; margin-left: 50px;" type="file" class="form-control-file" id="uploadFile"> <label class="col-lg-2 control-label" style="margin-top:10px">Image</label>
<div class="col-lg-9" style="margin-top:10px">
<input type="file" id="file" name="images[]" multiple accept="image/jpg,image/png,image/jpeg,image/gif">
</div>
</div>
</div> </div>
</div> </div>
...@@ -1103,7 +1122,7 @@ ...@@ -1103,7 +1122,7 @@
<thead style="text-align: center;"> <thead style="text-align: center;">
<tr> <tr>
<th style="padding: 0 0 0 0px;"> <th style="padding: 0 0 0 0px;">
<img src="static/img/image/`+ feature.administrasi.f8 +`.`+ feature.administrasi.f11 +`" alt="Image" style="width: 100%;max-height: 237px;height:237"> <img src="static/img/image/`+ feature.administrasi.f8 +`" alt="Image" style="width: 100%;max-height: 237px;height:237">
</th> </th>
</tr> </tr>
</thead> </thead>
...@@ -1251,23 +1270,26 @@ ...@@ -1251,23 +1270,26 @@
$(document).on("click", "#saveeditpuskes", function() { $(document).on("click", "#saveeditpuskes", function() {
var idka = $('#idpuskes').val(); var idka = $('#idpuskes').val();
var poi = $('#coordinateZoneeditpuskes').val(); var poi = $('#coordinateZoneeditpuskes').val();
console.log(poi) var data = new FormData();
data.append("file", $("input[id^='file']")[0].files[0]);
data.append("csrfmiddlewaretoken", "{{ csrf_token }}");
data.append('idpus',idka)
data.append('namobj', $('#namobj').val())
data.append('remark', $('#remark').val())
data.append('luasbangunan', $('#luas_bangunan').val())
data.append('luastanah', $('#luas_tanah').val())
data.append('tinggibangunan', $('#tinggi_bangunan').val())
data.append('alamat', $('#alamat').val())
data.append('perangkat', $('#perangkat').val())
data.append('point', poi)
$.ajax({ $.ajax({
url: "{% url 'api:puskesmas' %}", url: "{% url 'api:puskesmas' %}",
data: { data: data,
'idpus': idka,
'namobj': $('#namobj').val(),
'remark': $('#remark').val(),
'luasbangunan': $('#luas_bangunan').val(),
'luastanah': $('#luas_tanah').val(),
'tinggibangunan': $('#tinggi_bangunan').val(),
'alamat': $('#alamat').val(),
'perangkat': $('#perangkat').val(),
'point': poi
},
dataType: 'json', dataType: 'json',
type: 'POST', type: 'POST',
processData: false,
contentType: false,
success: function(data) { success: function(data) {
alert('sukses') alert('sukses')
location.reload() location.reload()
...@@ -1446,8 +1468,12 @@ ...@@ -1446,8 +1468,12 @@
<div class="tab-pane" id="right-tab2-feas-upl"> <div class="tab-pane" id="right-tab2-feas-upl">
<div class="form-group"> <div class="form-group">
<div id="map-for-edit" style="width: 400px;height: 300px;position: relative;margin-left: 100px;"></div> <div id="map-for-edit" style="width: 400px;height: 300px;position: relative;margin-left: 100px;"></div>
<label style="margin-top: 10px; margin-left: 50px;" for="exampleFormControlFile1">Input Foto</label> <div class="form-group">
<input style="margin-top: 10px; margin-left: 50px;" type="file" class="form-control-file" id="uploadFile"> <label class="col-lg-2 control-label" style="margin-top:10px">Image</label>
<div class="col-lg-9" style="margin-top:10px">
<input type="file" id="file" name="images[]" multiple accept="image/jpg,image/png,image/jpeg,image/gif">
</div>
</div>
</div> </div>
</div> </div>
...@@ -1469,7 +1495,7 @@ ...@@ -1469,7 +1495,7 @@
<thead style="text-align: center;"> <thead style="text-align: center;">
<tr> <tr>
<th style="padding: 0 0 0 0px;"> <th style="padding: 0 0 0 0px;">
<img src="static/img/image/`+ feature.administrasi.f8 +`.`+ feature.administrasi.f11 +`" alt="Image" style="width: 100%;max-height: 237px;height:237"> <img src="static/img/image/`+ feature.administrasi.f8 +`" alt="Image" style="width: 100%;max-height: 237px;height:237">
</th> </th>
</tr> </tr>
</thead> </thead>
...@@ -1600,23 +1626,26 @@ ...@@ -1600,23 +1626,26 @@
$(document).on("click", "#saveeditrs", function() { $(document).on("click", "#saveeditrs", function() {
var idrs = $('#idrs').val(); var idrs = $('#idrs').val();
var poi = $('#coordinateZoneeditrs').val(); var poi = $('#coordinateZoneeditrs').val();
console.log(poi) var data = new FormData();
data.append("file", $("input[id^='file']")[0].files[0]);
data.append("csrfmiddlewaretoken", "{{ csrf_token }}");
data.append('idrs',idrs)
data.append('namobj', $('#namobj').val())
data.append('remark', $('#remark').val())
data.append('luasbangunan', $('#luas_bangunan').val())
data.append('luastanah', $('#luas_tanah').val())
data.append('tinggibangunan', $('#tinggi_bangunan').val())
data.append('alamat', $('#alamat').val())
data.append('perangkat', $('#perangkat').val())
data.append('point', poi)
$.ajax({ $.ajax({
url: "{% url 'api:rumahsakit' %}", url: "{% url 'api:rumahsakit' %}",
data: { data: data,
'idrs': idrs,
'namobj': $('#namobj').val(),
'remark': $('#remark').val(),
'luasbangunan': $('#luas_bangunan').val(),
'luastanah': $('#luas_tanah').val(),
'tinggibangunan': $('#tinggi_bangunan').val(),
'alamat': $('#alamat').val(),
'perangkat': $('#perangkat').val(),
'point': poi
},
dataType: 'json', dataType: 'json',
type: 'POST', type: 'POST',
processData: false,
contentType: false,
success: function(data) { success: function(data) {
alert('sukses') alert('sukses')
location.reload() location.reload()
...@@ -1855,8 +1884,12 @@ ...@@ -1855,8 +1884,12 @@
<div class="tab-pane" id="right-tab2-feas-upl"> <div class="tab-pane" id="right-tab2-feas-upl">
<div class="form-group"> <div class="form-group">
<div id="map-for-edit" style="width: 400px;height: 300px;position: relative;margin-left: 100px;"></div> <div id="map-for-edit" style="width: 400px;height: 300px;position: relative;margin-left: 100px;"></div>
<label style="margin-top: 10px; margin-left: 50px;" for="exampleFormControlFile1">Input Foto</label> <div class="form-group">
<input style="margin-top: 10px; margin-left: 50px;" type="file" class="form-control-file" id="uploadFile"> <label class="col-lg-2 control-label" style="margin-top:10px">Image</label>
<div class="col-lg-9" style="margin-top:10px">
<input type="file" id="file" name="images[]" multiple accept="image/jpg,image/png,image/jpeg,image/gif">
</div>
</div>
</div> </div>
</div> </div>
...@@ -1878,7 +1911,7 @@ ...@@ -1878,7 +1911,7 @@
<thead style="text-align: center;"> <thead style="text-align: center;">
<tr> <tr>
<th style="padding: 0 0 0 0px;"> <th style="padding: 0 0 0 0px;">
<img src="static/img/image/`+ feature.administrasi.f8 +`.`+ feature.administrasi.f11 +`" alt="Image" style="width: 100%;max-height: 237px;height:237"> <img src="static/img/image/`+ feature.administrasi.f8 +`" alt="Image" style="width: 100%;max-height: 237px;height:237">
</th> </th>
</tr> </tr>
...@@ -2014,23 +2047,25 @@ ...@@ -2014,23 +2047,25 @@
$(document).on("click", "#saveeditsi", function() { $(document).on("click", "#saveeditsi", function() {
var idsi = $('#idsi').val(); var idsi = $('#idsi').val();
var poi = $('#coordinateZoneeditsi').val(); var poi = $('#coordinateZoneeditsi').val();
console.log(poi) var data = new FormData();
data.append("file", $("input[id^='file']")[0].files[0]);
data.append("csrfmiddlewaretoken", "{{ csrf_token }}");
data.append('idsi',idsi)
data.append('namobj', $('#namobj').val())
data.append('remark', $('#remark').val())
data.append('luasbangunan', $('#luas_bangunan').val())
data.append('luastanah', $('#luas_tanah').val())
data.append('tinggibangunan', $('#tinggi_bangunan').val())
data.append('alamat', $('#alamat').val())
data.append('perangkat', $('#perangkat').val())
data.append('point', poi)
$.ajax({ $.ajax({
url: "{% url 'api:ibadah' %}", url: "{% url 'api:ibadah' %}",
data: { data: data,
'idsi': idsi,
'namobj': $('#namobj').val(),
'remark': $('#remark').val(),
'luasbangunan': $('#luas_bangunan').val(),
'luastanah': $('#luas_tanah').val(),
'tinggibangunan': $('#tinggi_bangunan').val(),
'alamat': $('#alamat').val(),
'perangkat': $('#perangkat').val(),
'point': poi
},
dataType: 'json', dataType: 'json',
type: 'POST', type: 'POST',
processData: false,
contentType: false,
success: function(data) { success: function(data) {
alert('sukses') alert('sukses')
location.reload() location.reload()
...@@ -2250,8 +2285,12 @@ ...@@ -2250,8 +2285,12 @@
<div class="tab-pane" id="right-tab2-feas-upl"> <div class="tab-pane" id="right-tab2-feas-upl">
<div class="form-group"> <div class="form-group">
<div id="map-for-edit" style="width: 400px;height: 300px;position: relative;margin-left: 100px;"></div> <div id="map-for-edit" style="width: 400px;height: 300px;position: relative;margin-left: 100px;"></div>
<label style="margin-top: 10px; margin-left: 50px;" for="exampleFormControlFile1">Input Foto</label> <div class="form-group">
<input style="margin-top: 10px; margin-left: 50px;" type="file" class="form-control-file" id="uploadFile"> <label class="col-lg-2 control-label" style="margin-top:10px">Image</label>
<div class="col-lg-9" style="margin-top:10px">
<input type="file" id="file" name="images[]" multiple accept="image/jpg,image/png,image/jpeg,image/gif">
</div>
</div>
</div> </div>
</div> </div>
...@@ -2273,7 +2312,7 @@ ...@@ -2273,7 +2312,7 @@
<thead style="text-align: center;"> <thead style="text-align: center;">
<tr> <tr>
<th style="padding: 0 0 0 0px;"> <th style="padding: 0 0 0 0px;">
<img src="static/img/image/`+ feature.administrasi.f8 +`.`+ feature.administrasi.f11 +`" alt="Image" style="width: 100%;max-height: 237px;height:237"> <img src="static/img/image/`+ feature.administrasi.f8 +`" alt="Image" style="width: 100%;max-height: 237px;height:237">
</th> </th>
</tr> </tr>
</thead> </thead>
...@@ -2420,23 +2459,26 @@ ...@@ -2420,23 +2459,26 @@
$(document).on("click", "#saveeditsp", function() { $(document).on("click", "#saveeditsp", function() {
var idsp = $('#idsp').val(); var idsp = $('#idsp').val();
var poi = $('#coordinateZoneeditsp').val(); var poi = $('#coordinateZoneeditsp').val();
console.log(poi) var data = new FormData();
data.append("file", $("input[id^='file']")[0].files[0]);
data.append("csrfmiddlewaretoken", "{{ csrf_token }}");
data.append('idsp',idsp)
data.append('namobj', $('#namobj').val())
data.append('remark', $('#remark').val())
data.append('luasbangunan', $('#luas_bangunan').val())
data.append('luastanah', $('#luas_tanah').val())
data.append('tinggibangunan', $('#tinggi_bangunan').val())
data.append('alamat', $('#alamat').val())
data.append('perangkat', $('#perangkat').val())
data.append('point', poi)
$.ajax({ $.ajax({
url: "{% url 'api:sekolah' %}", url: "{% url 'api:sekolah' %}",
data: { data: data,
'idsp': idsp,
'namobj': $('#namobj').val(),
'remark': $('#remark').val(),
'luasbangunan': $('#luas_bangunan').val(),
'luastanah': $('#luas_tanah').val(),
'tinggibangunan': $('#tinggi_bangunan').val(),
'alamat': $('#alamat').val(),
'perangkat': $('#perangkat').val(),
'point': poi
},
dataType: 'json', dataType: 'json',
type: 'POST', type: 'POST',
processData: false,
contentType: false,
success: function(data) { success: function(data) {
alert('sukses') alert('sukses')
location.reload() location.reload()
...@@ -2615,8 +2657,12 @@ ...@@ -2615,8 +2657,12 @@
<div class="tab-pane" id="right-tab2-feas-upl"> <div class="tab-pane" id="right-tab2-feas-upl">
<div class="form-group"> <div class="form-group">
<div id="map-for-edit" style="width: 400px;height: 300px;position: relative;margin-left: 100px;"></div> <div id="map-for-edit" style="width: 400px;height: 300px;position: relative;margin-left: 100px;"></div>
<label style="margin-top: 10px; margin-left: 50px;" for="exampleFormControlFile1">Input Foto</label> <div class="form-group">
<input style="margin-top: 10px; margin-left: 50px;" type="file" class="form-control-file" id="uploadFile"> <label class="col-lg-2 control-label" style="margin-top:10px">Image</label>
<div class="col-lg-9" style="margin-top:10px">
<input type="file" id="file" name="images[]" multiple accept="image/jpg,image/png,image/jpeg,image/gif">
</div>
</div>
</div> </div>
</div> </div>
...@@ -2638,7 +2684,7 @@ ...@@ -2638,7 +2684,7 @@
<thead style="text-align: center;"> <thead style="text-align: center;">
<tr> <tr>
<th style="padding: 0 0 0 0px;"> <th style="padding: 0 0 0 0px;">
<img src="static/img/image/`+ feature.administrasi.f8 +`.`+ feature.administrasi.f11 +`" alt="Image" style="width: 100%;max-height: 237px;height:237"> <img src="static/img/image/`+ feature.administrasi.f8 +`" alt="Image" style="width: 100%;max-height: 237px;height:237">
</th> </th>
</tr> </tr>
</thead> </thead>
...@@ -2771,22 +2817,25 @@ ...@@ -2771,22 +2817,25 @@
var idspbu = $('#idspbu').val(); var idspbu = $('#idspbu').val();
var poi = $('#coordinateZoneeditspbu').val(); var poi = $('#coordinateZoneeditspbu').val();
console.log(poi) console.log(poi)
var data = new FormData();
data.append("file", $("input[id^='file']")[0].files[0]);
data.append("csrfmiddlewaretoken", "{{ csrf_token }}");
data.append('idspbu',idspbu)
data.append('namobj', $('#namobj').val())
data.append('remark', $('#remark').val())
data.append('luasbangunan', $('#luas_bangunan').val())
data.append('luastanah', $('#luas_tanah').val())
data.append('tinggibangunan', $('#tinggi_bangunan').val())
data.append('alamat', $('#alamat').val())
data.append('perangkat', $('#perangkat').val())
data.append('point', poi)
$.ajax({ $.ajax({
url: "{% url 'api:spbu' %}", url: "{% url 'api:spbu' %}",
data: { data: data,
'idspbu': idspbu,
'namobj': $('#namobj').val(),
'remark': $('#remark').val(),
'luasbangunan': $('#luas_bangunan').val(),
'luastanah': $('#luas_tanah').val(),
'tinggibangunan': $('#tinggi_bangunan').val(),
'alamat': $('#alamat').val(),
'perangkat': $('#perangkat').val(),
'point': poi
},
dataType: 'json', dataType: 'json',
type: 'POST', type: 'POST',
processData: false,
contentType: false,
success: function(data) { success: function(data) {
alert("sukses") alert("sukses")
location.reload() location.reload()
...@@ -2965,8 +3014,12 @@ ...@@ -2965,8 +3014,12 @@
<div class="tab-pane" id="right-tab2-feas-upl"> <div class="tab-pane" id="right-tab2-feas-upl">
<div class="form-group"> <div class="form-group">
<div id="map-for-edit" style="width: 400px;height: 300px;position: relative;margin-left: 100px;"></div> <div id="map-for-edit" style="width: 400px;height: 300px;position: relative;margin-left: 100px;"></div>
<label style="margin-top: 10px; margin-left: 50px;" for="exampleFormControlFile1">Input Foto</label> <div class="form-group">
<input style="margin-top: 10px; margin-left: 50px;" type="file" class="form-control-file" id="uploadFile"> <label class="col-lg-2 control-label" style="margin-top:10px">Image</label>
<div class="col-lg-9" style="margin-top:10px">
<input type="file" id="file" name="images[]" multiple accept="image/jpg,image/png,image/jpeg,image/gif">
</div>
</div>
</div> </div>
</div> </div>
...@@ -2988,7 +3041,7 @@ ...@@ -2988,7 +3041,7 @@
<thead style="text-align: center;"> <thead style="text-align: center;">
<tr> <tr>
<th style="padding: 0 0 0 0px;"> <th style="padding: 0 0 0 0px;">
<img src="static/img/image/`+ feature.administrasi.f8 +`.`+ feature.administrasi.f11 +`" alt="Image" style="width: 100%;max-height: 237px;height:237"> <img src="static/img/image/`+ feature.administrasi.f8 +`" alt="Image" style="width: 100%;max-height: 237px;height:237">
</th> </th>
</tr> </tr>
</thead> </thead>
...@@ -3120,22 +3173,25 @@ ...@@ -3120,22 +3173,25 @@
var idst = $('#idst').val(); var idst = $('#idst').val();
var poi = $('#coordinateZoneeditst').val(); var poi = $('#coordinateZoneeditst').val();
console.log(poi) console.log(poi)
var data = new FormData();
data.append("file", $("input[id^='file']")[0].files[0]);
data.append("csrfmiddlewaretoken", "{{ csrf_token }}");
data.append('idst',idst)
data.append('namobj', $('#namobj').val())
data.append('remark', $('#remark').val())
data.append('luasbangunan', $('#luas_bangunan').val())
data.append('luastanah', $('#luas_tanah').val())
data.append('tinggibangunan', $('#tinggi_bangunan').val())
data.append('alamat', $('#alamat').val())
data.append('perangkat', $('#perangkat').val())
data.append('point', poi)
$.ajax({ $.ajax({
url: "{% url 'api:stasiun' %}", url: "{% url 'api:stasiun' %}",
data: { data: data,
'idst': idst,
'namobj': $('#namobj').val(),
'remark': $('#remark').val(),
'luasbangunan': $('#luas_bangunan').val(),
'luastanah': $('#luas_tanah').val(),
'tinggibangunan': $('#tinggi_bangunan').val(),
'alamat': $('#alamat').val(),
'perangkat': $('#perangkat').val(),
'point': poi
},
dataType: 'json', dataType: 'json',
type: 'POST', type: 'POST',
processData: false,
contentType: false,
success: function(data) { success: function(data) {
alert("sukses") alert("sukses")
location.reload() location.reload()
...@@ -3277,8 +3333,12 @@ ...@@ -3277,8 +3333,12 @@
<div class="tab-pane" id="right-tab2-feas-upl"> <div class="tab-pane" id="right-tab2-feas-upl">
<div class="form-group"> <div class="form-group">
<div id="map-for-edit" style="width: 400px;height: 300px;position: relative;margin-left: 100px;"></div> <div id="map-for-edit" style="width: 400px;height: 300px;position: relative;margin-left: 100px;"></div>
<label style="margin-top: 10px; margin-left: 50px;" for="exampleFormControlFile1">Input Foto</label> <div class="form-group">
<input style="margin-top: 10px; margin-left: 50px;" type="file" class="form-control-file" id="uploadFile"> <label class="col-lg-2 control-label" style="margin-top:10px">Image</label>
<div class="col-lg-9" style="margin-top:10px">
<input type="file" id="file" name="images[]" multiple accept="image/jpg,image/png,image/jpeg,image/gif">
</div>
</div>
</div> </div>
</div> </div>
...@@ -3300,7 +3360,7 @@ ...@@ -3300,7 +3360,7 @@
<thead style="text-align: center;"> <thead style="text-align: center;">
<tr> <tr>
<th style="padding: 0 0 0 0px;"> <th style="padding: 0 0 0 0px;">
<img src="static/img/image/`+ feature.administrasi.f8 +`.`+ feature.administrasi.f11 +`" alt="Image" style="width: 100%;max-height: 237px;height:237"> <img src="static/img/image/`+ feature.administrasi.f8 +`" alt="Image" style="width: 100%;max-height: 237px;height:237">
</th> </th>
</tr> </tr>
</thead> </thead>
...@@ -3413,21 +3473,24 @@ ...@@ -3413,21 +3473,24 @@
$(document).on("click", "#saveedittr", function() { $(document).on("click", "#saveedittr", function() {
var idtr = $('#idtr').val(); var idtr = $('#idtr').val();
var poi = $('#coordinateZoneedittr').val(); var poi = $('#coordinateZoneedittr').val();
console.log(poi) var data = new FormData();
data.append("file", $("input[id^='file']")[0].files[0]);
data.append("csrfmiddlewaretoken", "{{ csrf_token }}");
data.append('idtr',idtr)
data.append('namobj', $('#namobj').val())
data.append('remark', $('#remark').val())
data.append('luas', $('#luas_bangunan').val())
data.append('alamat', $('#alamat').val())
data.append('perangkat', $('#perangkat').val())
data.append('point', poi)
$.ajax({ $.ajax({
url: "{% url 'api:terminal' %}", url: "{% url 'api:terminal' %}",
data: { data: data,
'idtr': idtr,
'namobj': $('#namobj').val(),
'remark': $('#remark').val(),
'luas': $('#luas_bangunan').val(),
'alamat': $('#alamat').val(),
'perangkat': $('#perangkat').val(),
'point': poi
},
dataType: 'json', dataType: 'json',
type: 'POST', type: 'POST',
processData: false,
contentType: false,
success: function(data) { success: function(data) {
alert("sukses") alert("sukses")
location.reload() location.reload()
...@@ -3569,8 +3632,12 @@ ...@@ -3569,8 +3632,12 @@
<div class="tab-pane" id="right-tab2-feas-upl"> <div class="tab-pane" id="right-tab2-feas-upl">
<div class="form-group"> <div class="form-group">
<div id="map-for-edit" style="width: 400px;height: 300px;position: relative;margin-left: 100px;"></div> <div id="map-for-edit" style="width: 400px;height: 300px;position: relative;margin-left: 100px;"></div>
<label style="margin-top: 10px; margin-left: 50px;" for="exampleFormControlFile1">Input Foto</label> <div class="form-group">
<input style="margin-top: 10px; margin-left: 50px;" type="file" class="form-control-file" id="uploadFile"> <label class="col-lg-2 control-label" style="margin-top:10px">Image</label>
<div class="col-lg-9" style="margin-top:10px">
<input type="file" id="file" name="images[]" multiple accept="image/jpg,image/png,image/jpeg,image/gif">
</div>
</div>
</div> </div>
</div> </div>
...@@ -3592,7 +3659,7 @@ ...@@ -3592,7 +3659,7 @@
<thead style="text-align: center;"> <thead style="text-align: center;">
<tr> <tr>
<th style="padding: 0 0 0 0px;"> <th style="padding: 0 0 0 0px;">
<img src="static/img/image/`+ feature.administrasi.f4 +`.`+ feature.administrasi.f6 +`" alt="Image" style="width: 100%;max-height: 237px;height:237"> <img src="static/img/image/`+ feature.administrasi.f4 +`" alt="Image" style="width: 100%;max-height: 237px;height:237">
</th> </th>
</tr> </tr>
</thead> </thead>
...@@ -3717,21 +3784,24 @@ ...@@ -3717,21 +3784,24 @@
$(document).on("click", "#saveeditcb", function() { $(document).on("click", "#saveeditcb", function() {
var idcb = $('#idcb').val(); var idcb = $('#idcb').val();
var poi = $('#coordinateZoneeditcb').val(); var poi = $('#coordinateZoneeditcb').val();
console.log(poi) var data = new FormData();
data.append("file", $("input[id^='file']")[0].files[0]);
data.append("csrfmiddlewaretoken", "{{ csrf_token }}");
data.append('idcb',idcb)
data.append('namobj', $('#namobj').val())
data.append('remark', $('#remark').val())
data.append('luas', $('#luas_bangunan').val())
data.append('alamat', $('#alamat').val())
data.append('perangkat', $('#perangkat').val())
data.append('point', poi)
$.ajax({ $.ajax({
url: "{% url 'api:cagarbudaya' %}", url: "{% url 'api:cagarbudaya' %}",
data: { data: data,
'idcb': idcb,
'namobj': $('#namobj').val(),
'remark': $('#remark').val(),
'luas': $('#luas_bangunan').val(),
'alamat': $('#alamat').val(),
'perangkat': $('#perangkat').val(),
'point': poi
},
dataType: 'json', dataType: 'json',
type: 'POST', type: 'POST',
processData: false,
contentType: false,
success: function(data) { success: function(data) {
alert("sukses") alert("sukses")
location.reload() location.reload()
...@@ -3910,8 +3980,12 @@ ...@@ -3910,8 +3980,12 @@
<div class="tab-pane" id="right-tab2-feas-upl"> <div class="tab-pane" id="right-tab2-feas-upl">
<div class="form-group"> <div class="form-group">
<div id="map-for-edit" style="width: 400px;height: 300px;position: relative;margin-left: 100px;"></div> <div id="map-for-edit" style="width: 400px;height: 300px;position: relative;margin-left: 100px;"></div>
<label style="margin-top: 10px; margin-left: 50px;" for="exampleFormControlFile1">Input Foto</label> <div class="form-group">
<input style="margin-top: 10px; margin-left: 50px;" type="file" class="form-control-file" id="uploadFile"> <label class="col-lg-2 control-label" style="margin-top:10px">Image</label>
<div class="col-lg-9" style="margin-top:10px">
<input type="file" id="file" name="images[]" multiple accept="image/jpg,image/png,image/jpeg,image/gif">
</div>
</div>
</div> </div>
</div> </div>
...@@ -3933,7 +4007,7 @@ ...@@ -3933,7 +4007,7 @@
<thead style="text-align: center;"> <thead style="text-align: center;">
<tr> <tr>
<th style="padding: 0 0 0 0px;"> <th style="padding: 0 0 0 0px;">
<img src="static/img/image/`+ feature.administrasi.f8 +`.`+ feature.administrasi.f11 +`" alt="Image" style="width: 100%;max-height: 237px;height:237"> <img src="static/img/image/`+ feature.administrasi.f8 +`" alt="Image" style="width: 100%;max-height: 237px;height:237">
</th> </th>
</tr> </tr>
</thead> </thead>
...@@ -4066,22 +4140,26 @@ ...@@ -4066,22 +4140,26 @@
$(document).on("click", "#saveeditgl", function() { $(document).on("click", "#saveeditgl", function() {
var idgl = $('#idgl').val(); var idgl = $('#idgl').val();
var poi = $('#coordinateZoneeditgl').val(); var poi = $('#coordinateZoneeditgl').val();
var data = new FormData();
data.append("file", $("input[id^='file']")[0].files[0]);
data.append("csrfmiddlewaretoken", "{{ csrf_token }}");
data.append('idgl',idgl)
data.append('namobj', $('#namobj').val())
data.append('remark', $('#remark').val())
data.append('luasbangunan', $('#luas_bangunan').val())
data.append('luastanah', $('#luas_tanah').val())
data.append('tinggibangunan', $('#tinggi_bangunan').val())
data.append('alamat', $('#alamat').val())
data.append('perangkat', $('#perangkat').val())
data.append('point', poi)
$.ajax({ $.ajax({
url: "{% url 'api:gardu' %}", url: "{% url 'api:gardu' %}",
data: { data: data,
'idgl': idgl,
'namobj': $('#namobj').val(),
'remark': $('#remark').val(),
'luasbangunan': $('#luas_bangunan').val(),
'luastanah': $('#luas_tanah').val(),
'tinggibangunan': $('#tinggi_bangunan').val(),
'alamat': $('#alamat').val(),
'perangkat': $('#perangkat').val(),
'point': poi
},
dataType: 'json', dataType: 'json',
type: 'POST', type: 'POST',
processData: false,
contentType: false,
success: function(data) { success: function(data) {
alert("sukses") alert("sukses")
location.reload() location.reload()
......
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