diff --git a/account/views.py b/account/views.py index 02a3ba2b94210c7a124abd24329c918435d6ce86..e7134e2ed667039d7f32e54cfee09ccbdfdf4978 100644 --- a/account/views.py +++ b/account/views.py @@ -371,7 +371,7 @@ def register_admin(request): return render(request, 'register_admin.html', context) # check email is already registered or not - cursor.execute(f'select * from user_acc where email = \'{email}\'') + cursor.execute(f'select * from sirest.user_acc where email = \'{email}\'') records = cursor.fetchmany() if len(records) > 0: form = RegisterFormAdmin(request.POST or None) diff --git a/templates/navbar.html b/templates/navbar.html index a3acdd76e0ee0d26c3a44ff8c201cede036158e8..71e740783f3736e44796626333c593d44ceb1768 100644 --- a/templates/navbar.html +++ b/templates/navbar.html @@ -32,27 +32,7 @@ <div id="list-navbar" class="text-base text-white hidden md:show md:flex md:flex-row md:items-center md:justify-end"> <div class="md:mx-5 my-3 md:my-0"> <a href="{% url 'account:show_main' %}" class="hover:text-[#DBC8AC] hover:text-lg duration-500">Dashboard</a> - </div> - - <!-- {admin start} --> - {% if role == 'admin' %} - <div @click.away="open = false" class="relative" x-data="{ open: false }"> - <button @click="open = !open" class="flex flex-row items-center w-full md:mx-5 my-3 md:my-0 text-left bg-transparent rounded-lg focus:outline-none focus:shadow-outline hover:text-[#DBC8AC] hover:text-lg duration-500"> - <span>Restoran</span> - <svg fill="currentColor" viewBox="0 0 20 20" :class="{'rotate-180': open, 'rotate-0': !open}" class="inline w-4 h-4 mt-1 ml-1 transition-transform duration-200 transform md:-mt-1"><path fill-rule="evenodd" d="M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z" clip-rule="evenodd"></path></svg> - </button> - <div x-show="open" x-transition:enter="transition ease-out duration-100" x-transition:enter-start="transform opacity-0 scale-95" x-transition:enter-end="transform opacity-100 scale-100" x-transition:leave="transition ease-in duration-75" x-transition:leave-start="transform opacity-100 scale-100" x-transition:leave-end="transform opacity-0 scale-95" class="absolute right-0 w-full mt-2 origin-top-right rounded-md shadow-lg md:w-48"> - <div class="px-2 py-2 bg-white text-gray-900 rounded-md shadow "> - <a class="block px-4 py-2 mt-2 rounded-lg hover:bg-gray-200 focus:bg-gray-200 focus:outline-none focus:shadow-outline" href="{% url 'trigger5:daftar_kategori' %}">Daftar Kategori Restoran</a> - <a class="block px-4 py-2 mt-2 rounded-lg hover:bg-gray-200 focus:bg-gray-200 focus:outline-none focus:shadow-outline" href="{% url 'trigger5:buat_kategori' %}">Buat Kategori Restoran</a> - <a class="block px-4 py-2 mt-2 rounded-lg hover:bg-gray-200 focus:bg-gray-200 focus:outline-none focus:shadow-outline" href="#">Daftar Kategori Makanan</a> - <a class="block px-4 py-2 mt-2 rounded-lg hover:bg-gray-200 focus:bg-gray-200 focus:outline-none focus:shadow-outline" href="#">Buat Kategori Makanan</a> - <a class="block px-4 py-2 mt-2 rounded-lg hover:bg-gray-200 focus:bg-gray-200 focus:outline-none focus:shadow-outline" href="{% url 'trigger5:daftar_bahanmakanan' %}">Daftar Bahan Makanan</a> - <a class="block px-4 py-2 mt-2 rounded-lg hover:bg-gray-200 focus:bg-gray-200 focus:outline-none focus:shadow-outline" href="{% url 'trigger5:buat_bahanmakanan' %}">Buat Bahan Makanan</a> - <a class="block px-4 py-2 mt-2 rounded-lg hover:bg-gray-200 focus:bg-gray-200 focus:outline-none focus:shadow-outline" href="{% url 'trigger3:daftar_restoran' %}">Daftar Restoran dan Makanan</a> - </div> - </div> - </div> + </div> <!-- {admin start} --> {% if role == 'admin' %} @@ -86,41 +66,13 @@ class="absolute right-0 w-full mt-2 origin-top-right rounded-md shadow-lg md:w-48" > <div class="px-2 py-2 bg-white text-gray-900 rounded-md shadow"> - <a - class="block px-4 py-2 mt-2 rounded-lg hover:bg-gray-200 focus:bg-gray-200 focus:outline-none focus:shadow-outline" - href="#" - >Daftar Kategori Restoran</a - > - <a - class="block px-4 py-2 mt-2 rounded-lg hover:bg-gray-200 focus:bg-gray-200 focus:outline-none focus:shadow-outline" - href="#" - >Buat Kategori Restoran</a - > - <a - class="block px-4 py-2 mt-2 rounded-lg hover:bg-gray-200 focus:bg-gray-200 focus:outline-none focus:shadow-outline" - href="#" - >Daftar Kategori Makanan</a - > - <a - class="block px-4 py-2 mt-2 rounded-lg hover:bg-gray-200 focus:bg-gray-200 focus:outline-none focus:shadow-outline" - href="#" - >Buat Kategori Makanan</a - > - <a - class="block px-4 py-2 mt-2 rounded-lg hover:bg-gray-200 focus:bg-gray-200 focus:outline-none focus:shadow-outline" - href="#" - >Daftar Bahan Makanan</a - > - <a - class="block px-4 py-2 mt-2 rounded-lg hover:bg-gray-200 focus:bg-gray-200 focus:outline-none focus:shadow-outline" - href="#" - >Buat Bahan Makanan</a - > - <a - class="block px-4 py-2 mt-2 rounded-lg hover:bg-gray-200 focus:bg-gray-200 focus:outline-none focus:shadow-outline" - href="#" - >Daftar Restoran dan Makanan</a - > + <a class="block px-4 py-2 mt-2 rounded-lg hover:bg-gray-200 focus:bg-gray-200 focus:outline-none focus:shadow-outline" href="{% url 'trigger5:daftar_kategori' %}">Daftar Kategori Restoran</a> + <a class="block px-4 py-2 mt-2 rounded-lg hover:bg-gray-200 focus:bg-gray-200 focus:outline-none focus:shadow-outline" href="{% url 'trigger5:buat_kategori' %}">Buat Kategori Restoran</a> + <a class="block px-4 py-2 mt-2 rounded-lg hover:bg-gray-200 focus:bg-gray-200 focus:outline-none focus:shadow-outline" href="#">Daftar Kategori Makanan</a> + <a class="block px-4 py-2 mt-2 rounded-lg hover:bg-gray-200 focus:bg-gray-200 focus:outline-none focus:shadow-outline" href="#">Buat Kategori Makanan</a> + <a class="block px-4 py-2 mt-2 rounded-lg hover:bg-gray-200 focus:bg-gray-200 focus:outline-none focus:shadow-outline" href="{% url 'trigger5:daftar_bahanmakanan' %}">Daftar Bahan Makanan</a> + <a class="block px-4 py-2 mt-2 rounded-lg hover:bg-gray-200 focus:bg-gray-200 focus:outline-none focus:shadow-outline" href="{% url 'trigger5:buat_bahanmakanan' %}">Buat Bahan Makanan</a> + <a class="block px-4 py-2 mt-2 rounded-lg hover:bg-gray-200 focus:bg-gray-200 focus:outline-none focus:shadow-outline" href="{% url 'trigger3:daftar_restoran' %}">Daftar Restoran dan Makanan</a> </div> </div> </div> @@ -169,20 +121,6 @@ </div> </div> - <div @click.away="open = false" class="relative" x-data="{ open: false }"> - <button @click="open = !open" class="flex flex-row items-center w-full md:mx-5 my-3 md:my-0 text-left bg-transparent rounded-lg focus:outline-none focus:shadow-outline hover:text-[#DBC8AC] hover:text-lg duration-500"> - <span>Pesanan</span> - <svg fill="currentColor" viewBox="0 0 20 20" :class="{'rotate-180': open, 'rotate-0': !open}" class="inline w-4 h-4 mt-1 ml-1 transition-transform duration-200 transform md:-mt-1"><path fill-rule="evenodd" d="M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z" clip-rule="evenodd"></path></svg> - </button> - <div x-show="open" x-transition:enter="transition ease-out duration-100" x-transition:enter-start="transform opacity-0 scale-95" x-transition:enter-end="transform opacity-100 scale-100" x-transition:leave="transition ease-in duration-75" x-transition:leave-start="transform opacity-100 scale-100" x-transition:leave-end="transform opacity-0 scale-95" class="absolute right-0 w-full mt-2 origin-top-right rounded-md shadow-lg md:w-48"> - <div class="px-2 py-2 bg-white text-gray-900 rounded-md shadow "> - <a class="block px-4 py-2 mt-2 rounded-lg hover:bg-gray-200 focus:bg-gray-200 focus:outline-none focus:shadow-outline" href="{% url 'trigger3:tarif_detail' %}">Daftar Tarif Pengiriman per KM</a> - <a class="block px-4 py-2 mt-2 rounded-lg hover:bg-gray-200 focus:bg-gray-200 focus:outline-none focus:shadow-outline" href="{% url 'trigger3:tambah_tarif' %}">Buat Tarif Pengiriman per KM</a> - </div> - </div> - </div> - {% endif %} - <!-- admin end --> <div @click.away="open = false" class="relative" x-data="{ open: false }"> <button @click="open = !open" @@ -215,14 +153,10 @@ <div class="px-2 py-2 bg-white text-gray-900 rounded-md shadow"> <a class="block px-4 py-2 mt-2 rounded-lg hover:bg-gray-200 focus:bg-gray-200 focus:outline-none focus:shadow-outline" - href="#" + href="{% url 'trigger3:tarif_detail' %}" >Daftar Tarif Pengiriman per KM</a > - <a - class="block px-4 py-2 mt-2 rounded-lg hover:bg-gray-200 focus:bg-gray-200 focus:outline-none focus:shadow-outline" - href="#" - >Buat Tarif Pengiriman per KM</a - > + <a class="block px-4 py-2 mt-2 rounded-lg hover:bg-gray-200 focus:bg-gray-200 focus:outline-none focus:shadow-outline" href="{% url 'trigger3:tambah_tarif' %}">Buat Tarif Pengiriman per KM</a> </div> </div> </div> @@ -318,8 +252,7 @@ <a href="{% url 'trigger_2:saldo_restopay' %}" class="hover:text-[#DBC8AC] hover:text-lg duration-500" - >Restopay</a - > + >Restopay</a> </div> {% endif %} <!-- restoran end --> diff --git a/trigger_6/templates/daftar_promo_restoran.html b/trigger_6/templates/daftar_promo_restoran.html index b44bb03c19743b02b0631ad3fe94daeb13b22dce..d7d5635d01392e5c9030d0f152a11c316861818c 100644 --- a/trigger_6/templates/daftar_promo_restoran.html +++ b/trigger_6/templates/daftar_promo_restoran.html @@ -38,7 +38,7 @@ {% for record in records_promo_resto %} <tr class="bg-white border-b"> <th scope="row" class="py-4 px-6 font-medium text-gray-900 whitespace-nowrap"> - {{forloop.counter}} + {{record.8}} </th> <td class="py-4 px-6"> {{record.1}} diff --git a/trigger_6/views.py b/trigger_6/views.py index 70bc5a9827a106159479fd5b5ff409e5b7aec7ac..fec0868ea5727e1ed56ddf9b83ecd6573ad37fc0 100644 --- a/trigger_6/views.py +++ b/trigger_6/views.py @@ -12,13 +12,8 @@ def show_riwayat(request): role = request.COOKIES.get('role') email = request.COOKIES.get('email') - if role == None: - return redirect("/login") - if role != 'restaurant': - return redirect("/") - cursor.execute('set search_path to sirest') - + if role == 'restaurant': rname = request.COOKIES.get('rname') rbranch = request.COOKIES.get('rbranch') @@ -59,10 +54,6 @@ def show_riwayat(request): def show_detail_riwayat(request, email, datetime): role = request.COOKIES.get('role') - if role == None: - return redirect("/login") - if role != 'restaurant': - return redirect("/") cursor.execute('set search_path to sirest') # query riwayat by id sql = f'''select u.fname, u.lname, t.street, t.district, t.city, t.province, r.rname, r.rbranch, t.datetime, t.rating, foo.fname, foo.lname, co.platenum, co.vehicletype, co.vehiclebrand, @@ -102,11 +93,6 @@ def show_detail_riwayat(request, email, datetime): def show_form_penilaian(request, email, datetime): role = request.COOKIES.get('role') - if role == None: - return redirect("/login") - if role != 'restaurant': - return redirect("/") - cursor.execute('set search_path to sirest') if request.method == 'POST': @@ -131,21 +117,12 @@ def show_form_penilaian(request, email, datetime): def show_buat_promo(request): role = request.COOKIES.get('role') - if role == None: - return redirect("/login") - if role != 'restaurant': - return redirect("/") return render(request, 'buat_promo.html', {'role': request.COOKIES.get('role')}) def show_form_promo_minimum(request): role = request.COOKIES.get('role') - if role == None: - return redirect("/login") - if role != 'restaurant': - return redirect("/") - cursor.execute('set search_path to sirest') if request.method == "POST": @@ -183,11 +160,6 @@ def show_form_promo_minimum(request): def show_form_promo_hari_spesial(request): role = request.COOKIES.get('role') - if role == None: - return redirect("/login") - if role != 'restaurant': - return redirect("/") - cursor.execute('set search_path to sirest') if request.method == "POST": @@ -219,11 +191,6 @@ def show_form_promo_hari_spesial(request): def show_daftar_promo(request): role = request.COOKIES.get('role') - if role == None: - return redirect("/login") - if role != 'restaurant': - return redirect("/") - cursor.execute('set search_path to sirest') cursor.execute('select * from promo') @@ -260,11 +227,6 @@ def show_daftar_promo(request): def show_ubah_promo(request, jenis, id): role = request.COOKIES.get('role') - if role == None: - return redirect("/login") - if role != 'restaurant': - return redirect("/") - cursor.execute('set search_path to sirest') cursor.execute(f'select promoname from promo where id = \'{id}\'') @@ -307,11 +269,6 @@ def show_ubah_promo(request, jenis, id): def show_daftar_promo_restoran(request, rname, rbranch): role = request.COOKIES.get('role') - if role == None: - return redirect("/login") - if role != 'restaurant': - return redirect("/") - cursor.execute('set search_path to sirest') cursor.execute(f'select * from promo p, restaurant_promo r where p.id = r.pid and r.rname = \'{rname}\' and r.rbranch = \'{rbranch}\'') records_promo_resto = cursor.fetchall() @@ -338,11 +295,6 @@ def show_daftar_promo_restoran(request, rname, rbranch): def show_form_promo_restoran(request): role = request.COOKIES.get('role') - if role == None: - return redirect("/login") - if role != 'restaurant': - return redirect("/") - cursor.execute('set search_path to sirest') rname = request.COOKIES.get('rname') rbranch = request.COOKIES.get('rbranch') @@ -386,11 +338,6 @@ def show_form_promo_restoran(request): def show_form_ubah_promo_restoran(request, id): role = request.COOKIES.get('role') - if role == None: - return redirect("/login") - if role != 'restaurant': - return redirect("/") - cursor.execute('set search_path to sirest') cursor.execute( @@ -462,11 +409,6 @@ def show_form_ubah_promo_restoran(request, id): def show_detail_promo(request, id): role = request.COOKIES.get('role') - if role == None: - return redirect("/login") - if role != 'restaurant': - return redirect("/") - cursor.execute('set search_path to sirest') cursor.execute(f'select * from promo where id = \'{id}\'') @@ -498,11 +440,6 @@ def show_detail_promo(request, id): def show_detail_promo_restoran(request, rname, rbranch, id): role = request.COOKIES.get('role') - if role == None: - return redirect("/login") - if role != 'restaurant': - return redirect("/") - cursor.execute('set search_path to sirest') cursor.execute( @@ -538,11 +475,6 @@ def show_detail_promo_restoran(request, rname, rbranch, id): def delete_promo(request, id): role = request.COOKIES.get('role') - if role == None: - return redirect("/login") - if role != 'restaurant': - return redirect("/") - cursor.execute('set search_path to sirest') cursor.execute(f'delete from promo where id = \'{id}\'') @@ -553,11 +485,6 @@ def delete_promo(request, id): def delete_promo_restoran(request, rname, rbranch, id): role = request.COOKIES.get('role') - if role == None: - return redirect("/login") - if role != 'restaurant': - return redirect("/") - cursor.execute('set search_path to sirest') cursor.execute( @@ -568,11 +495,6 @@ def delete_promo_restoran(request, rname, rbranch, id): def ubah_form_input(request, id): role = request.COOKIES.get('role') - if role == None: - return redirect("/login") - if role != 'restaurant': - return redirect("/") - cursor.execute('set search_path to sirest') cursor.execute(f'select discount from sirest.promo where id = \'{id}\'')