예제 #1
0
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)
예제 #2
0
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)
예제 #3
0
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)
예제 #4
0
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)
예제 #5
0
 def get(self, request):
     user = request.user
     data = ConnectDB.getAllDataWithQuery(
             '''
             SELECT * FROM stasiun
             '''
         )
     return Response(data)
예제 #6
0
 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([{}])
예제 #7
0
 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([{}])
예제 #8
0
 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([{}])
예제 #9
0
 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([{}])
예제 #10
0
 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([{}])
예제 #11
0
def peminjaman_view(request):
    person = ConnectDB.getUserDataWithApi(request)
    response = ConnectDB.getPersonalDataWithApi(request, 'peminjaman',
                                                '/peminjaman/api/')
    response.update(person)
    return render(request, 'peminjaman.html', response)
예제 #12
0
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)
예제 #13
0
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)