diff --git a/account/forms.py b/account/forms.py index ca3eb22e23e233c003571911cb1d9457ea454f98..127a1cc433e5693c91134c5794e059a6c675e9f8 100644 --- a/account/forms.py +++ b/account/forms.py @@ -15,100 +15,96 @@ for record in records: class RegisterFormAdmin(forms.Form): email = forms.EmailField(label='Email', max_length=50, widget=forms.TextInput( - attrs={'class': 'form-control', 'placeholder': 'Email'})) + attrs={'class': 'form-control', 'placeholder': 'Email', 'oninvalid': "this.setCustomValidity('Data yang diisikan belum lengkap, silahkan lengkapi data terlebih dahulu')", 'oninput': "setCustomValidity('')"})) password = forms.CharField(label='Password', max_length=50, widget=forms.PasswordInput( - attrs={'class': 'form-control', 'placeholder': '***********'})) + attrs={'class': 'form-control', 'placeholder': '***********', 'oninvalid': "this.setCustomValidity('Data yang diisikan belum lengkap, silahkan lengkapi data terlebih dahulu')", 'oninput': "setCustomValidity('')"})) nama = forms.CharField(label='Nama', max_length=50, widget=forms.TextInput( - attrs={'class': 'form-control', 'placeholder': 'Nama'})) + attrs={'class': 'form-control', 'placeholder': 'Nama', 'oninvalid': "this.setCustomValidity('Data yang diisikan belum lengkap, silahkan lengkapi data terlebih dahulu')", 'oninput': "setCustomValidity('')"})) no_hp = forms.CharField(label='No HP', max_length=20, widget=forms.TextInput( - attrs={'class': 'form-control', 'placeholder': 'No HP'})) - - error_messages = { - 'required': 'This field is required', - } + attrs={'class': 'form-control', 'placeholder': 'No HP', 'oninvalid': "this.setCustomValidity('Data yang diisikan belum lengkap, silahkan lengkapi data terlebih dahulu')", 'oninput': "setCustomValidity('')"})) class RegisterFormPelanggan(forms.Form): email = forms.EmailField(label='Email', max_length=50, widget=forms.TextInput( - attrs={'class': 'form-control', 'placeholder': 'Email'})) + attrs={'class': 'form-control', 'placeholder': 'Email', 'oninvalid': "this.setCustomValidity('Data yang diisikan belum lengkap, silahkan lengkapi data terlebih dahulu')", 'oninput': "setCustomValidity('')"})) password = forms.CharField(label='Password', max_length=50, widget=forms.PasswordInput( - attrs={'class': 'form-control', 'placeholder': '***********'})) + attrs={'class': 'form-control', 'placeholder': '***********', 'oninvalid': "this.setCustomValidity('Data yang diisikan belum lengkap, silahkan lengkapi data terlebih dahulu')", 'oninput': "setCustomValidity('')"})) nama = forms.CharField(label='Nama', max_length=50, widget=forms.TextInput( - attrs={'class': 'form-control', 'placeholder': 'Nama'})) + attrs={'class': 'form-control', 'placeholder': 'Nama', 'oninvalid': "this.setCustomValidity('Data yang diisikan belum lengkap, silahkan lengkapi data terlebih dahulu')", 'oninput': "setCustomValidity('')"})) no_hp = forms.CharField(label='No HP', max_length=20, widget=forms.TextInput( - attrs={'class': 'form-control', 'placeholder': 'No HP'})) + attrs={'class': 'form-control', 'placeholder': 'No HP', 'oninvalid': "this.setCustomValidity('Data yang diisikan belum lengkap, silahkan lengkapi data terlebih dahulu')", 'oninput': "setCustomValidity('')"})) nik = forms.CharField(label='NIK', max_length=20, widget=forms.TextInput( - attrs={'class': 'form-control', 'placeholder': 'NIK'})) + attrs={'class': 'form-control', 'placeholder': 'NIK', 'oninvalid': "this.setCustomValidity('Data yang diisikan belum lengkap, silahkan lengkapi data terlebih dahulu')", 'oninput': "setCustomValidity('')"})) nama_bank = forms.CharField(label='Nama Bank', max_length=20, widget=forms.TextInput( - attrs={'class': 'form-control', 'placeholder': 'Nama Bank'})) + attrs={'class': 'form-control', 'placeholder': 'Nama Bank', 'oninvalid': "this.setCustomValidity('Data yang diisikan belum lengkap, silahkan lengkapi data terlebih dahulu')", 'oninput': "setCustomValidity('')"})) no_rekening = forms.CharField(label='No Rekening', max_length=20, widget=forms.TextInput( - attrs={'class': 'form-control', 'placeholder': 'No Rekening'})) + attrs={'class': 'form-control', 'placeholder': 'No Rekening', 'oninvalid': "this.setCustomValidity('Data yang diisikan belum lengkap, silahkan lengkapi data terlebih dahulu')", 'oninput': "setCustomValidity('')"})) # tanggal lahir date picker tanggal_lahir = forms.DateField(label='Tanggal Lahir', widget=forms.DateInput({ 'class': 'form-control', 'type': 'date'})) # jenis kelamin dropdown jenis_kelamin = forms.ChoiceField(label='Jenis Kelamin', choices=[('L', 'Laki-Laki'), ('P', 'Perempuan')], widget=forms.Select( - attrs={'class': 'border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 mt-2', 'placeholder': 'Jenis Kelamin'})) + attrs={'class': 'border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 mt-2', 'placeholder': 'Jenis Kelamin', 'oninvalid': "this.setCustomValidity('Data yang diisikan belum lengkap, silahkan lengkapi data terlebih dahulu')", 'oninput': "setCustomValidity('')"})) class RegisterFormRestoran(forms.Form): email = forms.EmailField(label='Email', max_length=50, widget=forms.TextInput( - attrs={'class': 'form-control', 'placeholder': 'Email'})) + attrs={'class': 'form-control', 'placeholder': 'Email', 'oninvalid': "this.setCustomValidity('Data yang diisikan belum lengkap, silahkan lengkapi data terlebih dahulu')", 'oninput': "setCustomValidity('')"})) password = forms.CharField(label='Password', max_length=50, widget=forms.PasswordInput( - attrs={'class': 'form-control', 'placeholder': '***********'})) + attrs={'class': 'form-control', 'placeholder': '***********', 'oninvalid': "this.setCustomValidity('Data yang diisikan belum lengkap, silahkan lengkapi data terlebih dahulu')", 'oninput': "setCustomValidity('')"})) nama = forms.CharField(label='Nama', max_length=50, widget=forms.TextInput( - attrs={'class': 'form-control', 'placeholder': 'Nama'})) + attrs={'class': 'form-control', 'placeholder': 'Nama', 'oninvalid': "this.setCustomValidity('Data yang diisikan belum lengkap, silahkan lengkapi data terlebih dahulu')", 'oninput': "setCustomValidity('')"})) no_hp = forms.CharField(label='No HP', max_length=20, widget=forms.TextInput( - attrs={'class': 'form-control', 'placeholder': 'No HP'})) + attrs={'class': 'form-control', 'placeholder': 'No HP', 'oninvalid': "this.setCustomValidity('Data yang diisikan belum lengkap, silahkan lengkapi data terlebih dahulu')", 'oninput': "setCustomValidity('')"})) nik = forms.CharField(label='NIK', max_length=20, widget=forms.TextInput( - attrs={'class': 'form-control', 'placeholder': 'NIK'})) + attrs={'class': 'form-control', 'placeholder': 'NIK', 'oninvalid': "this.setCustomValidity('Data yang diisikan belum lengkap, silahkan lengkapi data terlebih dahulu')", 'oninput': "setCustomValidity('')"})) nama_bank = forms.CharField(label='Nama Bank', max_length=20, widget=forms.TextInput( - attrs={'class': 'form-control', 'placeholder': 'Nama Bank'})) + attrs={'class': 'form-control', 'placeholder': 'Nama Bank', 'oninvalid': "this.setCustomValidity('Data yang diisikan belum lengkap, silahkan lengkapi data terlebih dahulu')", 'oninput': "setCustomValidity('')"})) no_rekening = forms.CharField(label='No Rekening', max_length=20, widget=forms.TextInput( - attrs={'class': 'form-control', 'placeholder': 'No Rekening'})) + attrs={'class': 'form-control', 'placeholder': 'No Rekening', 'oninvalid': "this.setCustomValidity('Data yang diisikan belum lengkap, silahkan lengkapi data terlebih dahulu')", 'oninput': "setCustomValidity('')"})) nama_restoran = forms.CharField(label='Nama Restoran', max_length=25, widget=forms.TextInput( - attrs={'class': 'form-control', 'placeholder': 'Nama Restoran'})) + attrs={'class': 'form-control', 'placeholder': 'Nama Restoran', 'oninvalid': "this.setCustomValidity('Data yang diisikan belum lengkap, silahkan lengkapi data terlebih dahulu')", 'oninput': "setCustomValidity('')"})) cabang = forms.CharField(label='Cabang', max_length=25, widget=forms.TextInput( - attrs={'class': 'form-control', 'placeholder': 'Cabang'})) + attrs={'class': 'form-control', 'placeholder': 'Cabang', 'oninvalid': "this.setCustomValidity('Data yang diisikan belum lengkap, silahkan lengkapi data terlebih dahulu')", 'oninput': "setCustomValidity('')"})) no_hp_restoran = forms.CharField(label='No Telepon Restoran', max_length=18, widget=forms.TextInput( attrs={'class': 'form-control', 'placeholder': 'No Telepon Restoran'})) jalan = forms.CharField(label='Jalan', max_length=30, widget=forms.TextInput( - attrs={'class': 'form-control', 'placeholder': 'Jalan'})) + attrs={'class': 'form-control', 'placeholder': 'Jalan', 'oninvalid': "this.setCustomValidity('Data yang diisikan belum lengkap, silahkan lengkapi data terlebih dahulu')", 'oninput': "setCustomValidity('')"})) kecamatan = forms.CharField(label='Kecamatan', max_length=20, widget=forms.TextInput( - attrs={'class': 'form-control', 'placeholder': 'Kecamatan'})) + attrs={'class': 'form-control', 'placeholder': 'Kecamatan', 'oninvalid': "this.setCustomValidity('Data yang diisikan belum lengkap, silahkan lengkapi data terlebih dahulu')", 'oninput': "setCustomValidity('')"})) kota = forms.CharField(label='Kota', max_length=20, widget=forms.TextInput( - attrs={'class': 'form-control', 'placeholder': 'Kota'})) + attrs={'class': 'form-control', 'placeholder': 'Kota', 'oninvalid': "this.setCustomValidity('Data yang diisikan belum lengkap, silahkan lengkapi data terlebih dahulu')", 'oninput': "setCustomValidity('')"})) # provinsi dropdown provinsi = forms.ChoiceField(label='Provinsi', choices=DATA_PROVINSI, widget=forms.Select( - attrs={'class': 'border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 mt-2l', 'placeholder': 'Provinsi'})) + attrs={'class': 'border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 mt-2l', 'placeholder': 'Provinsi', 'oninvalid' : "this.setCustomValidity('Data yang diisikan belum lengkap, silahkan lengkapi data terlebih dahulu')", 'oninput' : "setCustomValidity('')"})) # kategori dropdown kategori = forms.ChoiceField(label='Kategori', choices=DATA_KATEGORI, widget=forms.Select( - attrs={'class': 'border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 mt-2', 'placeholder': 'Kategori'})) + attrs={'class': 'border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 mt-2', 'placeholder': 'Kategori', 'oninvalid' : "this.setCustomValidity('Data yang diisikan belum lengkap, silahkan lengkapi data terlebih dahulu')", 'oninput' : "setCustomValidity('')"})) class RegisterFormKurir(forms.Form): email = forms.EmailField(label='Email', max_length=50, widget=forms.TextInput( - attrs={'class': 'form-control', 'placeholder': 'Email'})) + attrs={'class': 'form-control', 'placeholder': 'Email', 'oninvalid' : "this.setCustomValidity('Data yang diisikan belum lengkap, silahkan lengkapi data terlebih dahulu')", 'oninput' : "setCustomValidity('')"})) password = forms.CharField(label='Password', max_length=50, widget=forms.PasswordInput( - attrs={'class': 'form-control', 'placeholder': '***********'})) + attrs={'class': 'form-control', 'placeholder': '***********', 'oninvalid' : "this.setCustomValidity('Data yang diisikan belum lengkap, silahkan lengkapi data terlebih dahulu')", 'oninput' : "setCustomValidity('')"})) nama = forms.CharField(label='Nama', max_length=50, widget=forms.TextInput( - attrs={'class': 'form-control', 'placeholder': 'Nama'})) + attrs={'class': 'form-control', 'placeholder': 'Nama', 'oninvalid' : "this.setCustomValidity('Data yang diisikan belum lengkap, silahkan lengkapi data terlebih dahulu')", 'oninput' : "setCustomValidity('')"})) no_hp = forms.CharField(label='No HP', max_length=20, widget=forms.TextInput( - attrs={'class': 'form-control', 'placeholder': 'No HP'})) + attrs={'class': 'form-control', 'placeholder': 'No HP', 'oninvalid' : "this.setCustomValidity('Data yang diisikan belum lengkap, silahkan lengkapi data terlebih dahulu')", 'oninput' : "setCustomValidity('')"})) nik = forms.CharField(label='NIK', max_length=20, widget=forms.TextInput( - attrs={'class': 'form-control', 'placeholder': 'NIK'})) + attrs={'class': 'form-control', 'placeholder': 'NIK', 'oninvalid' : "this.setCustomValidity('Data yang diisikan belum lengkap, silahkan lengkapi data terlebih dahulu')", 'oninput' : "setCustomValidity('')"})) nama_bank = forms.CharField(label='Nama Bank', max_length=20, widget=forms.TextInput( - attrs={'class': 'form-control', 'placeholder': 'Nama Bank'})) + attrs={'class': 'form-control', 'placeholder': 'Nama Bank', 'oninvalid' : "this.setCustomValidity('Data yang diisikan belum lengkap, silahkan lengkapi data terlebih dahulu')", 'oninput' : "setCustomValidity('')"})) no_rekening = forms.CharField(label='No Rekening', max_length=20, widget=forms.TextInput( - attrs={'class': 'form-control', 'placeholder': 'No Rekening'})) + attrs={'class': 'form-control', 'placeholder': 'No Rekening', 'oninvalid' : "this.setCustomValidity('Data yang diisikan belum lengkap, silahkan lengkapi data terlebih dahulu')", 'oninput' : "setCustomValidity('')"})) plat_no_kendaraan = forms.CharField(label='Plat No Kendaraan', max_length=10, widget=forms.TextInput( - attrs={'class': 'form-control', 'placeholder': 'Plat No Kendaraan'})) + attrs={'class': 'form-control', 'placeholder': 'Plat No Kendaraan', 'oninvalid' : "this.setCustomValidity('Data yang diisikan belum lengkap, silahkan lengkapi data terlebih dahulu')", 'oninput' : "setCustomValidity('')"})) no_sim = forms.CharField(label='No SIM', max_length=20, widget=forms.TextInput( - attrs={'class': 'form-control', 'placeholder': 'No SIM'})) + attrs={'class': 'form-control', 'placeholder': 'No SIM', 'oninvalid' : "this.setCustomValidity('Data yang diisikan belum lengkap, silahkan lengkapi data terlebih dahulu')", 'oninput' : "setCustomValidity('')"})) # Jenis Kendaraan Dropdown jenis_kendaraan = forms.ChoiceField(label='Jenis Kendaraan', choices=[('Car', 'Mobil'), ('Motorcycle', 'Motor')], widget=forms.Select( - attrs={'class': 'border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 mt-2', 'placeholder': 'Jenis Kendaraan'})) + attrs={'class': 'border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 mt-2', 'placeholder': 'Jenis Kendaraan', 'oninvalid' : "this.setCustomValidity('Data yang diisikan belum lengkap, silahkan lengkapi data terlebih dahulu')", 'oninput' : "setCustomValidity('')"})) merk_kendaraan = forms.CharField(label='Merk Kendaraan', max_length=15, widget=forms.TextInput( - attrs={'class': 'form-control', 'placeholder': 'Merk Kendaraan'})) + attrs={'class': 'form-control', 'placeholder': 'Merk Kendaraan', 'oninvalid' : "this.setCustomValidity('Data yang diisikan belum lengkap, silahkan lengkapi data terlebih dahulu')", 'oninput' : "setCustomValidity('')"})) diff --git a/account/views.py b/account/views.py index 66416a2c21dca199866bd8955e398ba7f50f38b7..8619f615f629612d061c5ffd85b473937923281d 100644 --- a/account/views.py +++ b/account/views.py @@ -9,6 +9,9 @@ import re def show_main(request): + cursor.execute('set search_path to sirest') + + # Jika user sudah login, redirect ke halaman dashboard if request.COOKIES.get('role'): email = request.COOKIES.get('email') @@ -163,6 +166,7 @@ def show_main(request): def logout_user(request): + cursor.execute('set search_path to sirest') response = HttpResponseRedirect(reverse('account:show_main')) for cookie in request.COOKIES: response.delete_cookie(cookie) @@ -170,6 +174,7 @@ def logout_user(request): def login(request): + cursor.execute('set search_path to sirest') # if user is logged in, redirect to dashboard if request.COOKIES.get('role'): return HttpResponseRedirect(reverse('account:show_main')) @@ -332,10 +337,12 @@ def login(request): def register(request): + cursor.execute('set search_path to sirest') return render(request, 'register.html') def register_admin(request): + cursor.execute('set search_path to sirest') if request.method == 'POST' or 'post' and not request.method == 'GET': email = request.POST.get('email') password = request.POST.get('password') @@ -420,6 +427,7 @@ def register_admin(request): def register_pelanggan(request): + cursor.execute('set search_path to sirest') if request.method == 'POST' or 'post' and not request.method == 'GET': email = request.POST.get('email') password = request.POST.get('password') @@ -515,6 +523,7 @@ def register_pelanggan(request): def register_restoran(request): + cursor.execute('set search_path to sirest') if request.method == 'POST' or 'post' and not request.method == 'GET': email = request.POST.get('email') password = request.POST.get('password') @@ -617,6 +626,7 @@ def register_restoran(request): def register_kurir(request): + cursor.execute('set search_path to sirest') if request.method == 'POST' or 'post' and not request.method == 'GET': email = request.POST.get('email') password = request.POST.get('password') @@ -715,17 +725,14 @@ def register_kurir(request): def dashboard_admin(request): + cursor.execute('set search_path to sirest') role = request.COOKIES.get('role') - if role != 'admin': - return HttpResponseRedirect(reverse('account:show_main')) return render(request, 'dashboard_admin.html') def profile_restoran(request, email): - role = request.COOKIES.get('role') - if role != 'restaurant': - return HttpResponseRedirect(reverse('account:show_main')) + cursor.execute('set search_path to sirest') cursor.execute( f'select * from user_acc u, transaction_actor t, restaurant r where u.email = \'{email}\' and u.email = t.email and t.email = r.email') @@ -749,9 +756,8 @@ def profile_restoran(request, email): def profile_pelanggan(request, email): + cursor.execute('set search_path to sirest') role = request.COOKIES.get('role') - if role != 'customer': - return HttpResponseRedirect(reverse('account:show_main')) cursor.execute( f'select u.email, password, fname || \' \' || lname as name, phonenum, nik, bankname, accountno, birthdate, sex, restopay, adminid from user_acc u, transaction_actor t, customer c where u.email = \'{email}\' and u.email = t.email and t.email = c.email') @@ -764,9 +770,8 @@ def profile_pelanggan(request, email): def profile_kurir(request, email): + cursor.execute('set search_path to sirest') role = request.COOKIES.get('role') - if role != 'courier': - return HttpResponseRedirect(reverse('account:show_main')) cursor.execute( f'select * from user_acc u, transaction_actor t, courier c where u.email = \'{email}\' and u.email = t.email and t.email = c.email') @@ -778,6 +783,7 @@ def profile_kurir(request, email): return render(request, 'profile_kurir.html', context) def verifikasi_user(request, email_user, email_admin): + cursor.execute('set search_path to sirest') cursor.execute( f'update transaction_actor set adminid = \'{email_admin}\' where email = \'{email_user}\'') connection.commit() diff --git a/trigger_2/forms.py b/trigger_2/forms.py index cf582af72a95ad8448424325e0edca2dc134b077..1f1d135cd065c663a70a46cdd198ced15ddab296 100644 --- a/trigger_2/forms.py +++ b/trigger_2/forms.py @@ -6,35 +6,33 @@ DATA_HARI = [('Senin', 'Senin'), ('Selasa', 'Selasa'), ('Rabu', 'Rabu'), class FormIsiSaldo(forms.Form): saldo_pengisian = forms.IntegerField(label='Nominal Pengisian', widget=forms.TextInput( - attrs={'class': 'form-control', 'placeholder': 'Nominal'})) + attrs={'class': 'form-control', 'placeholder': 'Nominal', 'oninvalid': "this.setCustomValidity('Data yang diisikan belum lengkap, silahkan lengkapi data terlebih dahulu')", 'oninput': "setCustomValidity('')"})) class FormTarikSaldo(forms.Form): saldo_penarikan = forms.IntegerField(label='Nominal Penarikan', widget=forms.TextInput( - attrs={'class': 'form-control', 'placeholder': 'Nominal'})) + attrs={'class': 'form-control', 'placeholder': 'Nominal', 'oninvalid': "this.setCustomValidity('Data yang diisikan belum lengkap, silahkan lengkapi data terlebih dahulu')", 'oninput': "setCustomValidity('')"})) class FormBuatJamOperasional(forms.Form): # Hari dropdown hari = forms.ChoiceField(label='Hari', choices=DATA_HARI, widget=forms.Select( - attrs={'class': 'border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 mt-2', 'placeholder': 'Hari'})) + attrs={'class': 'border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 mt-2', 'placeholder': 'Hari', 'oninvalid': "this.setCustomValidity('Data yang diisikan belum lengkap, silahkan lengkapi data terlebih dahulu')", 'oninput': "setCustomValidity('')"})) # Jam buka time picker jam_buka = forms.TimeField(label='Jam Buka', widget=forms.TimeInput( - attrs={'class': 'w-[20rem] h-[2.5rem] rounded-lg border-2 border-gray-300', 'type': 'time'})) + attrs={'class': 'w-[20rem] h-[2.5rem] rounded-lg border-2 border-gray-300', 'type': 'time', 'oninvalid': "this.setCustomValidity('Data yang diisikan belum lengkap, silahkan lengkapi data terlebih dahulu')", 'oninput': "setCustomValidity('')"})) # Jam tutup time picker jam_tutup = forms.TimeField(label='Jam Tutup', widget=forms.TimeInput( - attrs={'class': 'w-[20rem] h-[2.5rem] rounded-lg border-2 border-gray-300', 'type': 'time'})) - - + attrs={'class': 'w-[20rem] h-[2.5rem] rounded-lg border-2 border-gray-300', 'type': 'time', 'oninvalid': "this.setCustomValidity('Data yang diisikan belum lengkap, silahkan lengkapi data terlebih dahulu')", 'oninput': "setCustomValidity('')"})) class FormEditJamOperasional(forms.Form): # Jam buka time picker jam_buka = forms.TimeField(label='Jam Buka', widget=forms.TimeInput( - attrs={'class': 'w-[20rem] h-[2.5rem] rounded-lg border-2 border-gray-300', 'type': 'time'})) + attrs={'class': 'w-[20rem] h-[2.5rem] rounded-lg border-2 border-gray-300', 'type': 'time', 'oninvalid': "this.setCustomValidity('Data yang diisikan belum lengkap, silahkan lengkapi data terlebih dahulu')", 'oninput': "setCustomValidity('')"})) # Jam tutup time picker jam_tutup = forms.TimeField(label='Jam Tutup', widget=forms.TimeInput( - attrs={'class': 'w-[20rem] h-[2.5rem] rounded-lg border-2 border-gray-300', 'type': 'time'})) \ No newline at end of file + attrs={'class': 'w-[20rem] h-[2.5rem] rounded-lg border-2 border-gray-300', 'type': 'time', 'oninvalid': "this.setCustomValidity('Data yang diisikan belum lengkap, silahkan lengkapi data terlebih dahulu')", 'oninput': "setCustomValidity('')"})) diff --git a/trigger_2/views.py b/trigger_2/views.py index cc8b6d05dabc34992a857576d534f146f58830cb..a01828f0cf2ee0374dc39769cd6d0e1c32c6c14b 100644 --- a/trigger_2/views.py +++ b/trigger_2/views.py @@ -10,6 +10,7 @@ from django.shortcuts import render, redirect def saldo_restopay(request): + cursor.execute('set search_path to sirest') email = request.COOKIES.get('email') cursor.execute( f"SELECT restopay FROM transaction_actor WHERE email = '{email}'") @@ -26,6 +27,7 @@ def saldo_restopay(request): def isi_saldo(request): + cursor.execute('set search_path to sirest') email = request.COOKIES.get('email') cursor.execute( f"select restopay, bankname, accountno from transaction_actor WHERE email = '{email}'") @@ -152,6 +154,7 @@ def isi_saldo(request): def tarik_saldo(request): + cursor.execute('set search_path to sirest') email = request.COOKIES.get('email') cursor.execute( f"select restopay, bankname, accountno from transaction_actor WHERE email = '{email}'") @@ -293,6 +296,7 @@ def tarik_saldo(request): def daftar_pesanan(request): + cursor.execute('set search_path to sirest') email = request.COOKIES.get('email') cursor.execute( @@ -324,6 +328,7 @@ def daftar_pesanan(request): def ubah_status_pesanan(request, email, datetime, status): + cursor.execute('set search_path to sirest') if status == "Nunggu Konfirmasi Resto": status = 3 elif status == "Pesanan Dibuat": @@ -370,6 +375,7 @@ def ubah_status_pesanan(request, email, datetime, status): def detail_pesanan(request, email, datetime): + cursor.execute('set search_path to sirest') cursor.execute( f""" select datetime, concat(fname, ' ', lname), street, district, city, province, totalfood, totaldiscount, deliveryfee, totalprice, payment_method.name, payment_status.name @@ -511,6 +517,7 @@ def detail_pesanan(request, email, datetime): def buat_jam_operasional(request): + cursor.execute('set search_path to sirest') email = request.COOKIES.get('email') rname = request.COOKIES.get('rname') rbranch = request.COOKIES.get('rbranch') @@ -602,6 +609,7 @@ def buat_jam_operasional(request): def daftar_jam_operasional(request): + cursor.execute('set search_path to sirest') email = request.COOKIES.get('email') rname = request.COOKIES.get('rname') rbranch = request.COOKIES.get('rbranch') @@ -629,6 +637,7 @@ def daftar_jam_operasional(request): def edit_jam_operasional(request, rname, rbranch, day): + cursor.execute('set search_path to sirest') if request.method == 'POST' or 'post' and not request.method == 'GET': jam_buka = request.POST.get('jam_buka') jam_tutup = request.POST.get('jam_tutup') @@ -697,6 +706,7 @@ def edit_jam_operasional(request, rname, rbranch, day): return render(request, 'edit_jam_operasional.html', context) def hapus_jam_operasional(request, rname, rbranch, day): + cursor.execute('set search_path to sirest') try: cursor.execute( f"""