def sepeda_lists(request): person = ConnectDB.getUserDataWithApi(request) response = ConnectDB.getPersonalDataWithApi(request, 'sepeda', '/sepeda/api/') print(response) response.update(person) return render(request, 'sepeda.html', response)
def penugasan_view(request): person = ConnectDB.getUserDataWithApi(request) if (person['role'] == "ANGGOTA"): return redirect('/') else: response = ConnectDB.getPersonalDataWithApi(request, 'penugasan', '/penugasan/api/') response.update(person) return render(request, 'penugasan.html', response)
def transaction_view(request): person = ConnectDB.getUserDataWithApi(request) if (person['role'] != "ANGGOTA"): return redirect('/') else: response = ConnectDB.getPersonalDataWithApi(request, 'transaksi', '/transaction/api/') response.update(person) return render(request, 'transaction.html', response)
def report_view(request): person = ConnectDB.getUserDataWithApi(request) print(person['role']) if (person['role'] == "ANGGOTA"): return redirect('/') else: response = ConnectDB.getPersonalDataWithApi(request, 'laporan', '/report/api/') response.update(person) return render(request, 'report.html', response)
def get(self, request): user = request.user data = ConnectDB.getAllDataWithQuery( ''' SELECT * FROM stasiun ''' ) return Response(data)
def get(self, request): user = request.user if (user.email == "ADMIN" or user.email == "PETUGAS"): data = ConnectDB.getDataWithQuery( ''' SELECT l.* FROM anggota a, laporan l, person p WHERE p.ktp = a.ktp AND a.no_kartu = l.no_kartu_anggota AND p.ktp = %s ''', [user.username]) return Response(data) else: return Response([{}])
def get(self, request): user = request.user if user.email == 'ANGGOTA': data = ConnectDB.getDataWithQuery( ''' SELECT m.* FROM anggota a, peminjaman m, person p WHERE p.ktp = a.ktp AND a.no_kartu = m.no_kartu_anggota AND p.ktp = %s ''', [user.username]) return Response(data) else: return Response([{}])
def get(self, request): user = request.user if (user.email == "ANGGOTA"): data = ConnectDB.getDataWithQuery( ''' SELECT t.* FROM transaksi t, anggota a, person p WHERE p.ktp = a.ktp AND a.no_kartu = t.no_kartu_anggota AND p.ktp = %s ''', [user.username]) return Response(data) else: return Response([{}])
def get(self, request): user = request.user if (user.email == 'ADMIN' or user.email == 'PETUGAS' or user.email == 'ANGGOTA'): data = ConnectDB.getDataWithQuery( ''' SELECT v.* FROM anggota a, voucher v, person p WHERE p.ktp = a.ktp AND a.no_kartu = v.no_kartu_anggota AND p.ktp = %s ''', [user.username]) return Response(data) else: return Response([{}])
def get(self, request): user = request.user if (user.email == "ADMIN" or user.email == "PETUGAS"): data = ConnectDB.getDataWithQuery( ''' SELECT s.* FROM penugasan s, person p WHERE p.ktp = s.ktp AND p.ktp = %s ''', [user.username] ) return Response(data) else: return Response([{}])
def peminjaman_view(request): person = ConnectDB.getUserDataWithApi(request) response = ConnectDB.getPersonalDataWithApi(request, 'peminjaman', '/peminjaman/api/') response.update(person) return render(request, 'peminjaman.html', response)
def voucher_view(request): person = ConnectDB.getUserDataWithApi(request) response = ConnectDB.getPersonalDataWithApi(request, 'voucher', '/voucher/api/') response.update(person) return render(request, 'voucher_view.html', response)
def stasiun_lists(request): person = ConnectDB.getUserDataWithApi(request) response = ConnectDB.getPersonalDataWithApi(request, 'stasiun', '/stasiun/api/') print(response) response.update(person) return render(request, 'stasiun.html', response)